@keep-network/tbtc-v2 1.7.0 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/.chainId +1 -1
- package/artifacts/BLS.json +223 -0
- package/artifacts/Bank.json +50 -40
- package/artifacts/BeaconAuthorization.json +273 -0
- package/artifacts/BeaconDkg.json +241 -0
- package/artifacts/BeaconDkgValidator.json +501 -0
- package/artifacts/BeaconInactivity.json +151 -0
- package/artifacts/BeaconSortitionPool.json +1187 -0
- package/artifacts/Bridge.json +449 -32
- package/artifacts/BridgeGovernance.json +22 -22
- package/artifacts/BridgeGovernanceParameters.json +10 -10
- package/artifacts/Deposit.json +12 -12
- package/artifacts/DepositSweep.json +12 -12
- package/artifacts/DonationVault.json +17 -17
- package/artifacts/EcdsaDkgValidator.json +517 -0
- package/artifacts/EcdsaInactivity.json +156 -0
- package/artifacts/EcdsaSortitionPool.json +1187 -0
- package/artifacts/Fraud.json +12 -12
- package/artifacts/LightRelay.json +38 -38
- package/artifacts/LightRelayMaintainerProxy.json +31 -31
- package/artifacts/MaintainerProxy.json +44 -44
- package/artifacts/MovingFunds.json +12 -12
- package/artifacts/NuCypherToken.json +711 -0
- package/artifacts/RandomBeacon.json +3271 -0
- package/artifacts/RandomBeaconChaosnet.json +252 -0
- package/artifacts/RandomBeaconGovernance.json +3499 -0
- package/artifacts/Redemption.json +12 -12
- package/artifacts/RedemptionWatchtower.json +39 -39
- package/artifacts/ReimbursementPool.json +509 -0
- package/artifacts/T.json +1148 -0
- package/artifacts/TBTC.json +37 -36
- package/artifacts/TBTCToken.json +738 -0
- package/artifacts/TBTCVault.json +47 -47
- package/artifacts/Timelock.json +148 -148
- package/artifacts/TokenStaking.json +2117 -0
- package/artifacts/TokenholderGovernor.json +1795 -0
- package/artifacts/TokenholderTimelock.json +1058 -0
- package/artifacts/VendingMachine.json +35 -34
- package/artifacts/VendingMachineNuCypher.json +400 -0
- package/artifacts/VendingMachineV2.json +21 -21
- package/artifacts/VendingMachineV3.json +21 -21
- package/artifacts/WalletProposalValidator.json +12 -12
- package/artifacts/WalletRegistry.json +1962 -0
- package/artifacts/WalletRegistryGovernance.json +2863 -0
- package/artifacts/Wallets.json +12 -12
- package/artifacts/solcInputs/{be146ce112252bdda3a03de3614fbbf1.json → 2cb3f9e60e45f0ca528d3d5260ff3139.json} +31 -7
- package/build/contracts/GovernanceUtils.sol/GovernanceUtils.dbg.json +1 -1
- package/build/contracts/Timelock.sol/Timelock.dbg.json +1 -1
- package/build/contracts/bank/Bank.sol/Bank.dbg.json +1 -1
- package/build/contracts/bank/IReceiveBalanceApproval.sol/IReceiveBalanceApproval.dbg.json +1 -1
- package/build/contracts/bridge/BitcoinTx.sol/BitcoinTx.dbg.json +1 -1
- package/build/contracts/bridge/Bridge.sol/Bridge.dbg.json +1 -1
- package/build/contracts/bridge/BridgeGovernanceParameters.sol/BridgeGovernanceParameters.dbg.json +1 -1
- package/build/contracts/bridge/BridgeState.sol/BridgeState.dbg.json +1 -1
- package/build/contracts/bridge/Deposit.sol/Deposit.dbg.json +1 -1
- package/build/contracts/bridge/DepositSweep.sol/DepositSweep.dbg.json +1 -1
- package/build/contracts/bridge/EcdsaLib.sol/EcdsaLib.dbg.json +1 -1
- package/build/contracts/bridge/Fraud.sol/Fraud.dbg.json +1 -1
- package/build/contracts/bridge/Heartbeat.sol/Heartbeat.dbg.json +1 -1
- package/build/contracts/bridge/IRelay.sol/IRelay.dbg.json +1 -1
- package/build/contracts/bridge/MovingFunds.sol/MovingFunds.dbg.json +1 -1
- package/build/contracts/bridge/Redemption.sol/IRedemptionWatchtower.dbg.json +1 -1
- package/build/contracts/bridge/Redemption.sol/OutboundTx.dbg.json +1 -1
- package/build/contracts/bridge/Redemption.sol/Redemption.dbg.json +1 -1
- package/build/contracts/bridge/RedemptionWatchtower.sol/RedemptionWatchtower.dbg.json +1 -1
- package/build/contracts/bridge/VendingMachine.sol/VendingMachine.dbg.json +1 -1
- package/build/contracts/bridge/VendingMachineV2.sol/VendingMachineV2.dbg.json +1 -1
- package/build/contracts/bridge/VendingMachineV3.sol/VendingMachineV3.dbg.json +1 -1
- package/build/contracts/bridge/WalletProposalValidator.sol/WalletProposalValidator.dbg.json +1 -1
- package/build/contracts/bridge/Wallets.sol/Wallets.dbg.json +1 -1
- package/build/contracts/integrator/AbstractTBTCDepositor.sol/AbstractTBTCDepositor.dbg.json +1 -1
- package/build/contracts/integrator/IBridge.sol/IBridge.dbg.json +1 -1
- package/build/contracts/integrator/IBridge.sol/IBridgeTypes.dbg.json +1 -1
- package/build/contracts/integrator/ITBTCVault.sol/ITBTCVault.dbg.json +1 -1
- package/build/contracts/l2/L1BitcoinDepositor.sol/L1BitcoinDepositor.dbg.json +1 -1
- package/build/contracts/l2/L1BitcoinDepositor.sol/L1BitcoinDepositor.json +41 -2
- package/build/contracts/l2/L2BitcoinDepositor.sol/IL2WormholeGateway.dbg.json +1 -1
- package/build/contracts/l2/L2BitcoinDepositor.sol/L2BitcoinDepositor.dbg.json +1 -1
- package/build/contracts/l2/L2TBTC.sol/L2TBTC.dbg.json +1 -1
- package/build/contracts/l2/L2WormholeGateway.sol/L2WormholeGateway.dbg.json +1 -1
- package/build/contracts/l2/Wormhole.sol/IWormhole.dbg.json +1 -1
- package/build/contracts/l2/Wormhole.sol/IWormholeReceiver.dbg.json +1 -1
- package/build/contracts/l2/Wormhole.sol/IWormholeRelayer.dbg.json +1 -1
- package/build/contracts/l2/Wormhole.sol/IWormholeTokenBridge.dbg.json +1 -1
- package/build/contracts/l2/Wormhole.sol/WormholeTypes.dbg.json +1 -1
- package/build/contracts/l2/Wormhole.sol/WormholeUtils.dbg.json +1 -1
- package/build/contracts/maintainer/MaintainerProxy.sol/MaintainerProxy.dbg.json +1 -1
- package/build/contracts/relay/LightRelay.sol/ILightRelay.dbg.json +1 -1
- package/build/contracts/relay/LightRelay.sol/LightRelay.dbg.json +1 -1
- package/build/contracts/relay/LightRelay.sol/RelayUtils.dbg.json +1 -1
- package/build/contracts/relay/LightRelayMaintainerProxy.sol/LightRelayMaintainerProxy.dbg.json +1 -1
- package/build/contracts/test/BankStub.sol/BankStub.dbg.json +1 -1
- package/build/contracts/test/BridgeStub.sol/BridgeStub.dbg.json +1 -1
- package/build/contracts/test/HeartbeatStub.sol/HeartbeatStub.dbg.json +1 -1
- package/build/contracts/test/LightRelayStub.sol/LightRelayStub.dbg.json +1 -1
- package/build/contracts/test/ReceiveApprovalStub.sol/ReceiveApprovalStub.dbg.json +1 -1
- package/build/contracts/test/SepoliaLightRelay.sol/SepoliaLightRelay.dbg.json +1 -1
- package/build/contracts/test/SystemTestRelay.sol/SystemTestRelay.dbg.json +1 -1
- package/build/contracts/test/TestBitcoinTx.sol/TestBitcoinTx.dbg.json +1 -1
- package/build/contracts/test/TestERC20.sol/TestERC20.dbg.json +1 -1
- package/build/contracts/test/TestERC721.sol/TestERC721.dbg.json +1 -1
- package/build/contracts/test/TestEcdsaLib.sol/TestEcdsaLib.dbg.json +1 -1
- package/build/contracts/test/TestTBTCDepositor.sol/MockBridge.dbg.json +1 -1
- package/build/contracts/test/TestTBTCDepositor.sol/MockTBTCVault.dbg.json +1 -1
- package/build/contracts/test/TestTBTCDepositor.sol/TestTBTCDepositor.dbg.json +1 -1
- package/build/contracts/test/WormholeBridgeStub.sol/WormholeBridgeStub.dbg.json +1 -1
- package/build/contracts/token/TBTC.sol/TBTC.dbg.json +1 -1
- package/build/contracts/vault/DonationVault.sol/DonationVault.dbg.json +1 -1
- package/build/contracts/vault/IVault.sol/IVault.dbg.json +1 -1
- package/build/contracts/vault/TBTCOptimisticMinting.sol/TBTCOptimisticMinting.dbg.json +1 -1
- package/build/contracts/vault/TBTCVault.sol/TBTCVault.dbg.json +1 -1
- package/contracts/l2/L1BitcoinDepositor.sol +31 -0
- package/export/artifacts/@keep-network/ecdsa/contracts/EcdsaDkgValidator.sol/EcdsaDkgValidator.json +24 -24
- package/export/artifacts/@keep-network/ecdsa/contracts/WalletRegistry.sol/WalletRegistry.json +4999 -4814
- package/export/artifacts/@keep-network/ecdsa/contracts/libraries/EcdsaDkg.sol/EcdsaDkg.json +2 -2
- package/export/artifacts/@keep-network/ecdsa/contracts/libraries/EcdsaInactivity.sol/EcdsaInactivity.json +23 -23
- package/export/artifacts/@keep-network/random-beacon/contracts/ReimbursementPool.sol/ReimbursementPool.json +53 -53
- package/export/artifacts/@keep-network/sortition-pools/contracts/Chaosnet.sol/Chaosnet.json +21 -21
- package/export/artifacts/@keep-network/sortition-pools/contracts/Rewards.sol/Rewards.json +16 -16
- package/export/artifacts/@keep-network/sortition-pools/contracts/SortitionPool.sol/SortitionPool.json +206 -206
- package/export/artifacts/@keep-network/sortition-pools/contracts/SortitionTree.sol/SortitionTree.json +26 -26
- package/export/artifacts/@openzeppelin/contracts/governance/TimelockController.sol/TimelockController.json +107 -107
- package/export/artifacts/@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol/ERC1967Proxy.json +46 -46
- package/export/artifacts/@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol/ProxyAdmin.json +36 -36
- package/export/artifacts/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.json +78 -78
- package/export/artifacts/@openzeppelin/contracts/token/ERC721/ERC721.sol/ERC721.json +68 -68
- package/export/artifacts/@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol/ERC20Upgradeable.json +43 -43
- package/export/artifacts/@thesis/solidity-contracts/contracts/token/ERC20WithPermit.sol/ERC20WithPermit.json +79 -79
- package/export/artifacts/@thesis/solidity-contracts/contracts/token/MisfundRecovery.sol/MisfundRecovery.json +42 -42
- package/export/artifacts/contracts/Timelock.sol/Timelock.json +109 -109
- package/export/artifacts/contracts/bank/Bank.sol/Bank.json +77 -77
- package/export/artifacts/contracts/bridge/Bridge.sol/Bridge.json +338 -338
- package/export/artifacts/contracts/bridge/RedemptionWatchtower.sol/RedemptionWatchtower.json +128 -128
- package/export/artifacts/contracts/bridge/VendingMachine.sol/VendingMachine.json +108 -108
- package/export/artifacts/contracts/bridge/VendingMachineV2.sol/VendingMachineV2.json +63 -63
- package/export/artifacts/contracts/bridge/VendingMachineV3.sol/VendingMachineV3.json +65 -65
- package/export/artifacts/contracts/bridge/WalletProposalValidator.sol/WalletProposalValidator.json +67 -67
- package/export/artifacts/contracts/l2/L1BitcoinDepositor.sol/L1BitcoinDepositor.json +4431 -4171
- package/export/artifacts/contracts/l2/L2BitcoinDepositor.sol/L2BitcoinDepositor.json +62 -62
- package/export/artifacts/contracts/l2/L2TBTC.sol/L2TBTC.json +194 -194
- package/export/artifacts/contracts/l2/L2WormholeGateway.sol/L2WormholeGateway.json +102 -102
- package/export/artifacts/contracts/maintainer/MaintainerProxy.sol/MaintainerProxy.json +149 -149
- package/export/artifacts/contracts/relay/LightRelay.sol/LightRelay.json +76 -76
- package/export/artifacts/contracts/relay/LightRelayMaintainerProxy.sol/LightRelayMaintainerProxy.json +62 -62
- package/export/artifacts/contracts/test/BankStub.sol/BankStub.json +79 -79
- package/export/artifacts/contracts/test/BridgeStub.sol/BridgeStub.json +376 -376
- package/export/artifacts/contracts/test/HeartbeatStub.sol/HeartbeatStub.json +4 -4
- package/export/artifacts/contracts/test/LightRelayStub.sol/LightRelayStub.json +78 -78
- package/export/artifacts/contracts/test/ReceiveApprovalStub.sol/ReceiveApprovalStub.json +7 -7
- package/export/artifacts/contracts/test/SepoliaLightRelay.sol/SepoliaLightRelay.json +78 -78
- package/export/artifacts/contracts/test/SystemTestRelay.sol/SystemTestRelay.json +14 -14
- package/export/artifacts/contracts/test/TestBitcoinTx.sol/TestBitcoinTx.json +132 -132
- package/export/artifacts/contracts/test/TestERC20.sol/TestERC20.json +85 -85
- package/export/artifacts/contracts/test/TestERC721.sol/TestERC721.json +78 -78
- package/export/artifacts/contracts/test/TestEcdsaLib.sol/TestEcdsaLib.json +4 -4
- package/export/artifacts/contracts/test/TestTBTCDepositor.sol/MockBridge.json +34 -34
- package/export/artifacts/contracts/test/TestTBTCDepositor.sol/MockTBTCVault.json +20 -20
- package/export/artifacts/contracts/test/TestTBTCDepositor.sol/TestTBTCDepositor.json +52 -52
- package/export/artifacts/contracts/test/WormholeBridgeStub.sol/WormholeBridgeStub.json +37 -37
- package/export/artifacts/contracts/token/TBTC.sol/TBTC.json +104 -104
- package/export/artifacts/contracts/vault/DonationVault.sol/DonationVault.json +19 -19
- package/export/artifacts/contracts/vault/TBTCVault.sol/TBTCVault.json +184 -184
- package/export/deploy/00_resolve_reimbursement_pool.js +1 -1
- package/export/deploy/00_resolve_tbtc_v1_token.js +1 -1
- package/export/deploy/00_resolve_wallet_registry.js +1 -1
- package/export/deploy/01_deploy_light_relay.js +1 -1
- package/export/deploy/02_deploy_tbtc_v2_token.js +1 -1
- package/export/deploy/03_deploy_vending_machine.js +1 -1
- package/export/deploy/04_transfer_vending_machine_roles.js +1 -1
- package/export/deploy/05_deploy_bank.js +1 -1
- package/export/deploy/06_deploy_bridge.js +1 -1
- package/export/deploy/07_deploy_tbtc_vault.js +1 -1
- package/export/deploy/08_deploy_donation_vault.js +1 -1
- package/export/deploy/09_deploy_bridge_governance.js +1 -1
- package/export/deploy/10_deploy_maintainer_proxy.js +1 -1
- package/export/deploy/11_bank_update_bridge.js +1 -1
- package/export/deploy/12_authorize_tbtc_vault_in_bridge.js +1 -1
- package/export/deploy/13_authorize_maintainer_proxy_in_bridge.js +1 -1
- package/export/deploy/14_set_deposit_parameters.js +1 -1
- package/export/deploy/15_set_wallet_parameters.js +1 -1
- package/export/deploy/16_disable_fraud_challenges.js +1 -1
- package/export/deploy/17_disable_redemptions.js +1 -1
- package/export/deploy/18_disable_moving_funds.js +1 -1
- package/export/deploy/19_authorize_spv_maintainer_in_bridge.js +1 -1
- package/export/deploy/20_transfer_bank_ownership.js +1 -1
- package/export/deploy/21_transfer_bridge_governance.js +1 -1
- package/export/deploy/22_transfer_bridge_governance_ownership.js +1 -1
- package/export/deploy/23_transfer_tbtc_vault_ownership.js +1 -1
- package/export/deploy/24_transfer_tbtc_ownership.js +1 -1
- package/export/deploy/25_transfer_maintainer_proxy_ownership.js +1 -1
- package/export/deploy/26_transfer_proxy_admin_ownership.js +1 -1
- package/export/deploy/27_authorize_maintainer_proxy_in_reimbursement_pool.js +1 -1
- package/export/deploy/28_authorize_bridge_in_reimbursement_pool.js +1 -1
- package/export/deploy/29_deploy_proxy_admin_with_deputy.js +1 -1
- package/export/deploy/30_deploy_vending_machine_v2.js +1 -1
- package/export/deploy/31_deploy_vending_machine_v3.js +1 -1
- package/export/deploy/32_transfer_vending_machine_v2_ownership.js +1 -1
- package/export/deploy/33_transfer_vending_machine_v3_ownership.js +1 -1
- package/export/deploy/34_deploy_light_relay_maintainer_proxy.js +1 -1
- package/export/deploy/35_authorize_maintainer_in_light_relay_maintainer_proxy.js +1 -1
- package/export/deploy/36_transfer_light_relay_maintainer_proxy_ownership.js +1 -1
- package/export/deploy/37_authorize_light_relay_maintainer_proxy_in_reimbursement_pool.js +1 -1
- package/export/deploy/38_authorize_light_relay_maintainer_proxy_in_light_relay.js +1 -1
- package/export/deploy/39_deploy_wallet_proposal_validator.js +1 -1
- package/export/deploy/40_deploy_redemption_watchtower.js +1 -1
- package/export/deploy/41_transfer_redemption_watchtower_ownership.js +1 -1
- package/export/deploy/42_deploy_timelock.js +1 -1
- package/export/deploy/80_upgrade_bridge_v2.js +1 -1
- package/export/deploy/90_initialize_wallet_owner.js +1 -1
- package/export/deploy/91_genesis_relay.js +1 -1
- package/export/deploy/92_retarget_relay.js +1 -1
- package/export/deploy/93_authorize_relay_maintainer.js +1 -1
- package/export/deploy/94_transfer_relay_ownership.js +1 -1
- package/export/tasks/test-utils.js +1 -1
- package/export/test/integration/utils/ecdsa-wallet-registry.js +1 -1
- package/export/test/integration/utils/random-beacon.js +1 -1
- package/export/test/integration/utils/staking.js +1 -1
- package/export/typechain/factories/EcdsaAuthorization__factory.js +1 -1
- package/export/typechain/factories/IStaking__factory.js +24 -103
- package/export/typechain/factories/L1BitcoinDepositor__factory.js +40 -1
- package/export/typechain/factories/WalletRegistry__factory.js +1 -1
- package/package.json +6 -6
- package/artifacts/solcInputs/7c1f8f1dbded4c787d87a982d1fc8349.json +0 -410
- package/artifacts/solcInputs/7cc3eda3cb3ff2522d18b5e7b31ea228.json +0 -102
- package/artifacts/solcInputs/802132f7da69a8a4226cb9424480847b.json +0 -218
- package/artifacts/solcInputs/887fad6b16575ba42183543c324eeb0e.json +0 -335
- package/artifacts/solcInputs/98e272e2fbf178ec895387b6c503f9de.json +0 -68
- package/artifacts/solcInputs/b0025f1f7efe4824592ac0c9793776c3.json +0 -392
- package/artifacts/solcInputs/b7c5f3550cc22e16e6b6ea9582ccbee3.json +0 -341
- package/artifacts/solcInputs/d71d4b4434e6669852eaf643ebd2a7bc.json +0 -209
- package/artifacts/solcInputs/fccb130292c8c7cc958ab4fa31a3e180.json +0 -187
- package/export/deploy/00_resolve_relay.js +0 -83
- package/export/deploy/01_deploy_tbtc_v2_token.js +0 -70
- package/export/deploy/02_deploy_vending_machine.js +0 -84
- package/export/deploy/03_transfer_vending_machine_roles.js +0 -69
- package/export/deploy/04_deploy_bank.js +0 -73
- package/export/deploy/05_deploy_bridge.js +0 -178
- package/export/deploy/06_deploy_tbtc_vault.js +0 -80
- package/export/deploy/07_deploy_bridge_governance.js +0 -87
- package/export/deploy/08_deploy_maintainer_proxy.js +0 -80
- package/export/deploy/09_bank_update_bridge.js +0 -63
- package/export/deploy/10_authorize_spv_maintainer_in_bridge.js +0 -61
- package/export/deploy/11_transfer_bank_ownership.js +0 -60
- package/export/deploy/12_transfer_bridge_governance.js +0 -63
- package/export/deploy/13_transfer_bridge_governance_ownership.js +0 -60
- package/export/deploy/14_transfer_tbtc_vault_ownership.js +0 -60
- package/export/deploy/15_transfer_maintainer_proxy_ownership.js +0 -60
- package/export/deploy/16_initialize_wallet_owner.js +0 -63
- package/export/deploy/16_transfer_proxy_admin_ownership.js +0 -73
- package/export/deploy/17_authorize_maintainer_proxy_in_bridge.js +0 -63
- package/export/deploy/17_transfer_proxy_admin_ownership.js +0 -73
- package/export/deploy/18_authorize_maintainer_proxy_in_bridge.js +0 -63
- package/export/deploy/18_authorize_maintainer_proxy_in_reimbursement_pool.js +0 -63
- package/export/deploy/19_authorize_bridge_in_reimbursement_pool.js +0 -63
- package/export/deploy/19_authorize_maintainer_proxy_in_reimbursement_pool.js +0 -63
- package/export/deploy/20_authorize_bridge_in_reimbursement_pool.js +0 -63
- package/export/deploy/20_deploy_proxy_admin_with_deputy.js +0 -80
- package/export/deploy/21_transfer_reimbursement_pool_ownership.js +0 -60
- package/export/deploy/22_deploy_proxy_admin_with_deputy.js +0 -80
- package/export/deploy/24_transfer_maintainer_proxy_ownership.js +0 -60
- package/export/deploy/25_transfer_proxy_admin_ownership.js +0 -73
- package/export/deploy/26_authorize_maintainer_proxy_in_reimbursement_pool.js +0 -70
- package/export/deploy/27_authorize_bridge_in_reimbursement_pool.js +0 -70
- package/export/deploy/28_deploy_proxy_admin_with_deputy.js +0 -80
- package/export/deploy/34_deploy_wallet_coordinator.js +0 -115
- package/export/deploy/35_add_coordinator_address.js +0 -60
- package/export/deploy/35_transfer_wallet_coordinator_ownership.js +0 -60
- package/export/deploy/36_deploy_light_relay_maintainer_proxy.js +0 -86
- package/export/deploy/36_transfer_wallet_coordinator_ownership.js +0 -60
- package/export/deploy/37_authorize_maintainer_in_light_relay_maintainer_proxy.js +0 -65
- package/export/deploy/37_deploy_light_relay_maintainer_proxy.js +0 -86
- package/export/deploy/37_transfer_light_relay_maintainer_proxy_ownership.js +0 -60
- package/export/deploy/38_authorize_light_relay_maintainer_proxy_in_reimbursement_pool.js +0 -70
- package/export/deploy/38_authorize_maintainer_in_light_relay_maintainer_proxy.js +0 -65
- package/export/deploy/38_transfer_light_relay_maintainer_proxy_ownership.js +0 -60
- package/export/deploy/39_authorize_light_relay_maintainer_proxy_in_light_relay.js +0 -63
- package/export/deploy/39_authorize_light_relay_maintainer_proxy_in_reimbursement_pool.js +0 -70
- package/export/deploy/39_transfer_light_relay_maintainer_proxy_ownership.js +0 -60
- package/export/deploy/40_authorize_light_relay_maintainer_proxy_in_light_relay.js +0 -66
- package/export/deploy/40_authorize_light_relay_maintainer_proxy_in_reimbursement_pool.js +0 -70
- package/export/deploy/41_authorize_light_relay_maintainer_proxy_in_light_relay.js +0 -66
- package/export/typechain/GoerliLightRelay.js +0 -2
- package/export/typechain/RelayStub.js +0 -2
- package/export/typechain/TestRelay.js +0 -2
- package/export/typechain/WalletCoordinator.js +0 -2
- package/export/typechain/factories/GoerliLightRelay__factory.js +0 -535
- package/export/typechain/factories/RelayStub__factory.js +0 -546
- package/export/typechain/factories/TestRelay__factory.js +0 -168
- package/export/typechain/factories/WalletCoordinator__factory.js +0 -1121
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
{
|
|
2
|
+
"address": "0x0D4ff719551E23185Aeb16FFbF2ABEbB90635942",
|
|
3
|
+
"abi": [
|
|
4
|
+
{
|
|
5
|
+
"anonymous": false,
|
|
6
|
+
"inputs": [
|
|
7
|
+
{
|
|
8
|
+
"indexed": true,
|
|
9
|
+
"internalType": "bytes32",
|
|
10
|
+
"name": "resultHash",
|
|
11
|
+
"type": "bytes32"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"indexed": true,
|
|
15
|
+
"internalType": "address",
|
|
16
|
+
"name": "approver",
|
|
17
|
+
"type": "address"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"name": "DkgResultApproved",
|
|
21
|
+
"type": "event"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"anonymous": false,
|
|
25
|
+
"inputs": [
|
|
26
|
+
{
|
|
27
|
+
"indexed": true,
|
|
28
|
+
"internalType": "bytes32",
|
|
29
|
+
"name": "resultHash",
|
|
30
|
+
"type": "bytes32"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"indexed": true,
|
|
34
|
+
"internalType": "address",
|
|
35
|
+
"name": "challenger",
|
|
36
|
+
"type": "address"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"indexed": false,
|
|
40
|
+
"internalType": "string",
|
|
41
|
+
"name": "reason",
|
|
42
|
+
"type": "string"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"name": "DkgResultChallenged",
|
|
46
|
+
"type": "event"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"anonymous": false,
|
|
50
|
+
"inputs": [
|
|
51
|
+
{
|
|
52
|
+
"indexed": true,
|
|
53
|
+
"internalType": "bytes32",
|
|
54
|
+
"name": "resultHash",
|
|
55
|
+
"type": "bytes32"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"indexed": true,
|
|
59
|
+
"internalType": "uint256",
|
|
60
|
+
"name": "seed",
|
|
61
|
+
"type": "uint256"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"components": [
|
|
65
|
+
{
|
|
66
|
+
"internalType": "uint256",
|
|
67
|
+
"name": "submitterMemberIndex",
|
|
68
|
+
"type": "uint256"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"internalType": "bytes",
|
|
72
|
+
"name": "groupPubKey",
|
|
73
|
+
"type": "bytes"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"internalType": "uint8[]",
|
|
77
|
+
"name": "misbehavedMembersIndices",
|
|
78
|
+
"type": "uint8[]"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"internalType": "bytes",
|
|
82
|
+
"name": "signatures",
|
|
83
|
+
"type": "bytes"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"internalType": "uint256[]",
|
|
87
|
+
"name": "signingMembersIndices",
|
|
88
|
+
"type": "uint256[]"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"internalType": "uint32[]",
|
|
92
|
+
"name": "members",
|
|
93
|
+
"type": "uint32[]"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"internalType": "bytes32",
|
|
97
|
+
"name": "membersHash",
|
|
98
|
+
"type": "bytes32"
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
"indexed": false,
|
|
102
|
+
"internalType": "struct BeaconDkg.Result",
|
|
103
|
+
"name": "result",
|
|
104
|
+
"type": "tuple"
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
"name": "DkgResultSubmitted",
|
|
108
|
+
"type": "event"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"anonymous": false,
|
|
112
|
+
"inputs": [],
|
|
113
|
+
"name": "DkgSeedTimedOut",
|
|
114
|
+
"type": "event"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"anonymous": false,
|
|
118
|
+
"inputs": [
|
|
119
|
+
{
|
|
120
|
+
"indexed": true,
|
|
121
|
+
"internalType": "uint256",
|
|
122
|
+
"name": "seed",
|
|
123
|
+
"type": "uint256"
|
|
124
|
+
}
|
|
125
|
+
],
|
|
126
|
+
"name": "DkgStarted",
|
|
127
|
+
"type": "event"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"anonymous": false,
|
|
131
|
+
"inputs": [],
|
|
132
|
+
"name": "DkgStateLocked",
|
|
133
|
+
"type": "event"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"anonymous": false,
|
|
137
|
+
"inputs": [],
|
|
138
|
+
"name": "DkgTimedOut",
|
|
139
|
+
"type": "event"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"inputs": [],
|
|
143
|
+
"name": "groupSize",
|
|
144
|
+
"outputs": [
|
|
145
|
+
{
|
|
146
|
+
"internalType": "uint256",
|
|
147
|
+
"name": "",
|
|
148
|
+
"type": "uint256"
|
|
149
|
+
}
|
|
150
|
+
],
|
|
151
|
+
"stateMutability": "view",
|
|
152
|
+
"type": "function"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"inputs": [],
|
|
156
|
+
"name": "offchainDkgTime",
|
|
157
|
+
"outputs": [
|
|
158
|
+
{
|
|
159
|
+
"internalType": "uint256",
|
|
160
|
+
"name": "",
|
|
161
|
+
"type": "uint256"
|
|
162
|
+
}
|
|
163
|
+
],
|
|
164
|
+
"stateMutability": "view",
|
|
165
|
+
"type": "function"
|
|
166
|
+
}
|
|
167
|
+
],
|
|
168
|
+
"transactionHash": "0xbea4756fa4825d9fd227148fc8942cfa32d80092769c8d7aa329ace9490ebf73",
|
|
169
|
+
"receipt": {
|
|
170
|
+
"to": null,
|
|
171
|
+
"from": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8",
|
|
172
|
+
"contractAddress": "0x0D4ff719551E23185Aeb16FFbF2ABEbB90635942",
|
|
173
|
+
"transactionIndex": 0,
|
|
174
|
+
"gasUsed": "1092054",
|
|
175
|
+
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
|
176
|
+
"blockHash": "0x5dc2db6c87d58424c7ea9ed85f36b8e3e933066ba0dc7615ef8d93ef2af78f69",
|
|
177
|
+
"transactionHash": "0xbea4756fa4825d9fd227148fc8942cfa32d80092769c8d7aa329ace9490ebf73",
|
|
178
|
+
"logs": [],
|
|
179
|
+
"blockNumber": 19,
|
|
180
|
+
"cumulativeGasUsed": "1092054",
|
|
181
|
+
"status": 1,
|
|
182
|
+
"byzantium": true
|
|
183
|
+
},
|
|
184
|
+
"args": [],
|
|
185
|
+
"numDeployments": 1,
|
|
186
|
+
"metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"resultHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"approver\",\"type\":\"address\"}],\"name\":\"DkgResultApproved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"resultHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"challenger\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"reason\",\"type\":\"string\"}],\"name\":\"DkgResultChallenged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"resultHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"seed\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"submitterMemberIndex\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"groupPubKey\",\"type\":\"bytes\"},{\"internalType\":\"uint8[]\",\"name\":\"misbehavedMembersIndices\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes\",\"name\":\"signatures\",\"type\":\"bytes\"},{\"internalType\":\"uint256[]\",\"name\":\"signingMembersIndices\",\"type\":\"uint256[]\"},{\"internalType\":\"uint32[]\",\"name\":\"members\",\"type\":\"uint32[]\"},{\"internalType\":\"bytes32\",\"name\":\"membersHash\",\"type\":\"bytes32\"}],\"indexed\":false,\"internalType\":\"struct BeaconDkg.Result\",\"name\":\"result\",\"type\":\"tuple\"}],\"name\":\"DkgResultSubmitted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"DkgSeedTimedOut\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"seed\",\"type\":\"uint256\"}],\"name\":\"DkgStarted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"DkgStateLocked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"DkgTimedOut\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"groupSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"offchainDkgTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"approveResult(BeaconDkg.Data storage,BeaconDkg.Result)\":{\"details\":\"Can be called after a challenge period for the submitted result.\",\"params\":{\"result\":\"Result to approve. Must match the submitted result stored during `submitResult`.\"},\"returns\":{\"misbehavedMembers\":\"Identifiers of members who misbehaved during DKG.\"}},\"challengeResult(BeaconDkg.Data storage,BeaconDkg.Result)\":{\"details\":\"Can be called during a challenge period for the submitted result.\",\"params\":{\"result\":\"Result to challenge. Must match the submitted result stored during `submitResult`.\"},\"returns\":{\"maliciousResultHash\":\"Hash of the malicious result.\",\"maliciousSubmitter\":\"Identifier of the malicious submitter.\"}}},\"stateVariables\":{\"groupSize\":{\"details\":\"Size of a group in the threshold relay.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"approveResult(BeaconDkg.Data storage,BeaconDkg.Result)\":{\"notice\":\"Approves DKG result. Can be called when the challenge period for the submitted result is finished. Considers the submitted result as valid. For the first `submitterPrecedencePeriodLength` blocks after the end of the challenge period can be called only by the DKG result submitter. After that time, can be called by anyone.\"},\"challengeResult(BeaconDkg.Data storage,BeaconDkg.Result)\":{\"notice\":\"Challenges DKG result. If the submitted result is proved to be invalid it reverts the DKG back to the result submission phase.\"},\"offchainDkgTime()\":{\"notice\":\"Time in blocks after which DKG result is complete and ready to be\"},\"submitResult(BeaconDkg.Data storage,BeaconDkg.Result)\":{\"notice\":\"Allows to submit a DKG result. The submitted result does not go through a validation and before it gets accepted, it needs to wait through the challenge period during which everyone has a chance to challenge the result as invalid one. Submitter of the result needs to be in the sortition pool and if the result gets challenged, the submitter will get slashed.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/libraries/BeaconDkg.sol\":\"BeaconDkg\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@keep-network/sortition-pools/contracts/Branch.sol\":{\"content\":\"pragma solidity 0.8.17;\\n\\nimport \\\"./Constants.sol\\\";\\n\\n/// @notice The implicit 8-ary trees of the sortition pool\\n/// rely on packing 8 \\\"slots\\\" of 32-bit values into each uint256.\\n/// The Branch library permits efficient calculations on these slots.\\nlibrary Branch {\\n /// @notice Calculate the right shift required\\n /// to make the 32 least significant bits of an uint256\\n /// be the bits of the `position`th slot\\n /// when treating the uint256 as a uint32[8].\\n ///\\n /// @dev Not used for efficiency reasons,\\n /// but left to illustrate the meaning of a common pattern.\\n /// I wish solidity had macros, even C macros.\\n function slotShift(uint256 position) internal pure returns (uint256) {\\n unchecked {\\n return position * Constants.SLOT_WIDTH;\\n }\\n }\\n\\n /// @notice Return the `position`th slot of the `node`,\\n /// treating `node` as a uint32[32].\\n function getSlot(uint256 node, uint256 position)\\n internal\\n pure\\n returns (uint256)\\n {\\n unchecked {\\n uint256 shiftBits = position * Constants.SLOT_WIDTH;\\n // Doing a bitwise AND with `SLOT_MAX`\\n // clears all but the 32 least significant bits.\\n // Because of the right shift by `slotShift(position)` bits,\\n // those 32 bits contain the 32 bits in the `position`th slot of `node`.\\n return (node >> shiftBits) & Constants.SLOT_MAX;\\n }\\n }\\n\\n /// @notice Return `node` with the `position`th slot set to zero.\\n function clearSlot(uint256 node, uint256 position)\\n internal\\n pure\\n returns (uint256)\\n {\\n unchecked {\\n uint256 shiftBits = position * Constants.SLOT_WIDTH;\\n // Shifting `SLOT_MAX` left by `slotShift(position)` bits\\n // gives us a number where all bits of the `position`th slot are set,\\n // and all other bits are unset.\\n //\\n // Using a bitwise NOT on this number,\\n // we get a uint256 where all bits are set\\n // except for those of the `position`th slot.\\n //\\n // Bitwise ANDing the original `node` with this number\\n // sets the bits of `position`th slot to zero,\\n // leaving all other bits unchanged.\\n return node & ~(Constants.SLOT_MAX << shiftBits);\\n }\\n }\\n\\n /// @notice Return `node` with the `position`th slot set to `weight`.\\n ///\\n /// @param weight The weight of of the node.\\n /// Safely truncated to a 32-bit number,\\n /// but this should never be called with an overflowing weight regardless.\\n function setSlot(\\n uint256 node,\\n uint256 position,\\n uint256 weight\\n ) internal pure returns (uint256) {\\n unchecked {\\n uint256 shiftBits = position * Constants.SLOT_WIDTH;\\n // Clear the `position`th slot like in `clearSlot()`.\\n uint256 clearedNode = node & ~(Constants.SLOT_MAX << shiftBits);\\n // Bitwise AND `weight` with `SLOT_MAX`\\n // to clear all but the 32 least significant bits.\\n //\\n // Shift this left by `slotShift(position)` bits\\n // to obtain a uint256 with all bits unset\\n // except in the `position`th slot\\n // which contains the 32-bit value of `weight`.\\n uint256 shiftedWeight = (weight & Constants.SLOT_MAX) << shiftBits;\\n // When we bitwise OR these together,\\n // all other slots except the `position`th one come from the left argument,\\n // and the `position`th gets filled with `weight` from the right argument.\\n return clearedNode | shiftedWeight;\\n }\\n }\\n\\n /// @notice Calculate the summed weight of all slots in the `node`.\\n function sumWeight(uint256 node) internal pure returns (uint256 sum) {\\n unchecked {\\n sum = node & Constants.SLOT_MAX;\\n // Iterate through each slot\\n // by shifting `node` right in increments of 32 bits,\\n // and adding the 32 least significant bits to the `sum`.\\n uint256 newNode = node >> Constants.SLOT_WIDTH;\\n while (newNode > 0) {\\n sum += (newNode & Constants.SLOT_MAX);\\n newNode = newNode >> Constants.SLOT_WIDTH;\\n }\\n return sum;\\n }\\n }\\n\\n /// @notice Pick a slot in `node` that corresponds to `index`.\\n /// Treats the node like an array of virtual stakers,\\n /// the number of virtual stakers in each slot corresponding to its weight,\\n /// and picks which slot contains the `index`th virtual staker.\\n ///\\n /// @dev Requires that `index` be lower than `sumWeight(node)`.\\n /// However, this is not enforced for performance reasons.\\n /// If `index` exceeds the permitted range,\\n /// `pickWeightedSlot()` returns the rightmost slot\\n /// and an excessively high `newIndex`.\\n ///\\n /// @return slot The slot of `node` containing the `index`th virtual staker.\\n ///\\n /// @return newIndex The index of the `index`th virtual staker of `node`\\n /// within the returned slot.\\n function pickWeightedSlot(uint256 node, uint256 index)\\n internal\\n pure\\n returns (uint256 slot, uint256 newIndex)\\n {\\n unchecked {\\n newIndex = index;\\n uint256 newNode = node;\\n uint256 currentSlotWeight = newNode & Constants.SLOT_MAX;\\n while (newIndex >= currentSlotWeight) {\\n newIndex -= currentSlotWeight;\\n slot++;\\n newNode = newNode >> Constants.SLOT_WIDTH;\\n currentSlotWeight = newNode & Constants.SLOT_MAX;\\n }\\n return (slot, newIndex);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xa7fb1c9c9789f30493e9a40e24a24f46875dc5e7630b4f67478167759f6d1882\"},\"@keep-network/sortition-pools/contracts/Chaosnet.sol\":{\"content\":\"pragma solidity 0.8.17;\\n\\n/// @title Chaosnet\\n/// @notice This is a beta staker program for stakers willing to go the extra\\n/// mile with monitoring, share their logs with the dev team, and allow to more\\n/// carefully monitor the bootstrapping network. As the network matures, the\\n/// beta program will be ended.\\ncontract Chaosnet {\\n /// @notice Indicates if the chaosnet is active. The chaosnet is active\\n /// after the contract deployment and can be ended with a call to\\n /// `deactivateChaosnet()`. Once deactivated chaosnet can not be activated\\n /// again.\\n bool public isChaosnetActive;\\n\\n /// @notice Indicates if the given operator is a beta operator for chaosnet.\\n mapping(address => bool) public isBetaOperator;\\n\\n /// @notice Address controlling chaosnet status and beta operator addresses.\\n address public chaosnetOwner;\\n\\n event BetaOperatorsAdded(address[] operators);\\n\\n event ChaosnetOwnerRoleTransferred(\\n address oldChaosnetOwner,\\n address newChaosnetOwner\\n );\\n\\n event ChaosnetDeactivated();\\n\\n constructor() {\\n _transferChaosnetOwner(msg.sender);\\n isChaosnetActive = true;\\n }\\n\\n modifier onlyChaosnetOwner() {\\n require(msg.sender == chaosnetOwner, \\\"Not the chaosnet owner\\\");\\n _;\\n }\\n\\n modifier onlyOnChaosnet() {\\n require(isChaosnetActive, \\\"Chaosnet is not active\\\");\\n _;\\n }\\n\\n /// @notice Adds beta operator to chaosnet. Can be called only by the\\n /// chaosnet owner when the chaosnet is active. Once the operator is added\\n /// as a beta operator, it can not be removed.\\n function addBetaOperators(address[] calldata operators)\\n public\\n onlyOnChaosnet\\n onlyChaosnetOwner\\n {\\n for (uint256 i = 0; i < operators.length; i++) {\\n isBetaOperator[operators[i]] = true;\\n }\\n\\n emit BetaOperatorsAdded(operators);\\n }\\n\\n /// @notice Deactivates the chaosnet. Can be called only by the chaosnet\\n /// owner. Once deactivated chaosnet can not be activated again.\\n function deactivateChaosnet() public onlyOnChaosnet onlyChaosnetOwner {\\n isChaosnetActive = false;\\n emit ChaosnetDeactivated();\\n }\\n\\n /// @notice Transfers the chaosnet owner role to another non-zero address.\\n function transferChaosnetOwnerRole(address newChaosnetOwner)\\n public\\n onlyChaosnetOwner\\n {\\n require(\\n newChaosnetOwner != address(0),\\n \\\"New chaosnet owner must not be zero address\\\"\\n );\\n _transferChaosnetOwner(newChaosnetOwner);\\n }\\n\\n function _transferChaosnetOwner(address newChaosnetOwner) internal {\\n address oldChaosnetOwner = chaosnetOwner;\\n chaosnetOwner = newChaosnetOwner;\\n emit ChaosnetOwnerRoleTransferred(oldChaosnetOwner, newChaosnetOwner);\\n }\\n}\\n\",\"keccak256\":\"0xeaf7bdd5626f88c329793a012621039692ce1b6e1f13013997ddb13d7e3032df\"},\"@keep-network/sortition-pools/contracts/Constants.sol\":{\"content\":\"pragma solidity 0.8.17;\\n\\nlibrary Constants {\\n ////////////////////////////////////////////////////////////////////////////\\n // Parameters for configuration\\n\\n // How many bits a position uses per level of the tree;\\n // each branch of the tree contains 2**SLOT_BITS slots.\\n uint256 constant SLOT_BITS = 3;\\n uint256 constant LEVELS = 7;\\n ////////////////////////////////////////////////////////////////////////////\\n\\n ////////////////////////////////////////////////////////////////////////////\\n // Derived constants, do not touch\\n uint256 constant SLOT_COUNT = 2**SLOT_BITS;\\n uint256 constant SLOT_WIDTH = 256 / SLOT_COUNT;\\n uint256 constant LAST_SLOT = SLOT_COUNT - 1;\\n uint256 constant SLOT_MAX = (2**SLOT_WIDTH) - 1;\\n uint256 constant POOL_CAPACITY = SLOT_COUNT**LEVELS;\\n\\n uint256 constant ID_WIDTH = SLOT_WIDTH;\\n uint256 constant ID_MAX = SLOT_MAX;\\n\\n uint256 constant BLOCKHEIGHT_WIDTH = 96 - ID_WIDTH;\\n uint256 constant BLOCKHEIGHT_MAX = (2**BLOCKHEIGHT_WIDTH) - 1;\\n\\n uint256 constant SLOT_POINTER_MAX = (2**SLOT_BITS) - 1;\\n uint256 constant LEAF_FLAG = 1 << 255;\\n\\n uint256 constant WEIGHT_WIDTH = 256 / SLOT_COUNT;\\n ////////////////////////////////////////////////////////////////////////////\\n}\\n\",\"keccak256\":\"0xaef690ced707935745ff1482b7bb9bd9eb77bf6a39c717465e64cf12db8a7d39\"},\"@keep-network/sortition-pools/contracts/Leaf.sol\":{\"content\":\"pragma solidity 0.8.17;\\n\\nimport \\\"./Constants.sol\\\";\\n\\nlibrary Leaf {\\n function make(\\n address _operator,\\n uint256 _creationBlock,\\n uint256 _id\\n ) internal pure returns (uint256) {\\n assert(_creationBlock <= type(uint64).max);\\n assert(_id <= type(uint32).max);\\n // Converting a bytesX type into a larger type\\n // adds zero bytes on the right.\\n uint256 op = uint256(bytes32(bytes20(_operator)));\\n // Bitwise AND the id to erase\\n // all but the 32 least significant bits\\n uint256 uid = _id & Constants.ID_MAX;\\n // Erase all but the 64 least significant bits,\\n // then shift left by 32 bits to make room for the id\\n uint256 cb = (_creationBlock & Constants.BLOCKHEIGHT_MAX) <<\\n Constants.ID_WIDTH;\\n // Bitwise OR them all together to get\\n // [address operator || uint64 creationBlock || uint32 id]\\n return (op | cb | uid);\\n }\\n\\n function operator(uint256 leaf) internal pure returns (address) {\\n // Converting a bytesX type into a smaller type\\n // truncates it on the right.\\n return address(bytes20(bytes32(leaf)));\\n }\\n\\n /// @notice Return the block number the leaf was created in.\\n function creationBlock(uint256 leaf) internal pure returns (uint256) {\\n return ((leaf >> Constants.ID_WIDTH) & Constants.BLOCKHEIGHT_MAX);\\n }\\n\\n function id(uint256 leaf) internal pure returns (uint32) {\\n // Id is stored in the 32 least significant bits.\\n // Bitwise AND ensures that we only get the contents of those bits.\\n return uint32(leaf & Constants.ID_MAX);\\n }\\n}\\n\",\"keccak256\":\"0xbd107a1a43e48884885e5e966ffcbcd8fa5e89863715d717bb4006e9f89cdc2b\"},\"@keep-network/sortition-pools/contracts/Position.sol\":{\"content\":\"pragma solidity 0.8.17;\\n\\nimport \\\"./Constants.sol\\\";\\n\\nlibrary Position {\\n // Return the last 3 bits of a position number,\\n // corresponding to its slot in its parent\\n function slot(uint256 a) internal pure returns (uint256) {\\n return a & Constants.SLOT_POINTER_MAX;\\n }\\n\\n // Return the parent of a position number\\n function parent(uint256 a) internal pure returns (uint256) {\\n return a >> Constants.SLOT_BITS;\\n }\\n\\n // Return the location of the child of a at the given slot\\n function child(uint256 a, uint256 s) internal pure returns (uint256) {\\n return (a << Constants.SLOT_BITS) | (s & Constants.SLOT_POINTER_MAX); // slot(s)\\n }\\n\\n // Return the uint p as a flagged position uint:\\n // the least significant 21 bits contain the position\\n // and the 22nd bit is set as a flag\\n // to distinguish the position 0x000000 from an empty field.\\n function setFlag(uint256 p) internal pure returns (uint256) {\\n return p | Constants.LEAF_FLAG;\\n }\\n\\n // Turn a flagged position into an unflagged position\\n // by removing the flag at the 22nd least significant bit.\\n //\\n // We shouldn't _actually_ need this\\n // as all position-manipulating code should ignore non-position bits anyway\\n // but it's cheap to call so might as well do it.\\n function unsetFlag(uint256 p) internal pure returns (uint256) {\\n return p & (~Constants.LEAF_FLAG);\\n }\\n}\\n\",\"keccak256\":\"0xd3a927908080ac21353a92a6bce3d69e94a5c30f6b51f16b271b6cc679f110e2\"},\"@keep-network/sortition-pools/contracts/RNG.sol\":{\"content\":\"pragma solidity 0.8.17;\\n\\nimport \\\"./Leaf.sol\\\";\\nimport \\\"./Constants.sol\\\";\\n\\nlibrary RNG {\\n /// @notice Get an index in the range `[0 .. range-1]`\\n /// and the new state of the RNG,\\n /// using the provided `state` of the RNG.\\n ///\\n /// @param range The upper bound of the index, exclusive.\\n ///\\n /// @param state The previous state of the RNG.\\n /// The initial state needs to be obtained\\n /// from a trusted randomness oracle (the random beacon),\\n /// or from a chain of earlier calls to `RNG.getIndex()`\\n /// on an originally trusted seed.\\n ///\\n /// @dev Calculates the number of bits required for the desired range,\\n /// takes the least significant bits of `state`\\n /// and checks if the obtained index is within the desired range.\\n /// The original state is hashed with `keccak256` to get a new state.\\n /// If the index is outside the range,\\n /// the function retries until it gets a suitable index.\\n ///\\n /// @return index A random integer between `0` and `range - 1`, inclusive.\\n ///\\n /// @return newState The new state of the RNG.\\n /// When `getIndex()` is called one or more times,\\n /// care must be taken to always use the output `state`\\n /// of the most recent call as the input `state` of a subsequent call.\\n /// At the end of a transaction calling `RNG.getIndex()`,\\n /// the previous stored state must be overwritten with the latest output.\\n function getIndex(\\n uint256 range,\\n bytes32 state,\\n uint256 bits\\n ) internal view returns (uint256, bytes32) {\\n bool found = false;\\n uint256 index = 0;\\n bytes32 newState = state;\\n while (!found) {\\n index = truncate(bits, uint256(newState));\\n newState = keccak256(abi.encodePacked(newState, address(this)));\\n if (index < range) {\\n found = true;\\n }\\n }\\n return (index, newState);\\n }\\n\\n /// @notice Calculate how many bits are required\\n /// for an index in the range `[0 .. range-1]`.\\n ///\\n /// @param range The upper bound of the desired range, exclusive.\\n ///\\n /// @return uint The smallest number of bits\\n /// that can contain the number `range-1`.\\n function bitsRequired(uint256 range) internal pure returns (uint256) {\\n unchecked {\\n if (range == 1) {\\n return 0;\\n }\\n\\n uint256 bits = Constants.WEIGHT_WIDTH - 1;\\n\\n // Left shift by `bits`,\\n // so we have a 1 in the (bits + 1)th least significant bit\\n // and 0 in other bits.\\n // If this number is equal or greater than `range`,\\n // the range [0, range-1] fits in `bits` bits.\\n //\\n // Because we loop from high bits to low bits,\\n // we find the highest number of bits that doesn't fit the range,\\n // and return that number + 1.\\n while (1 << bits >= range) {\\n bits--;\\n }\\n\\n return bits + 1;\\n }\\n }\\n\\n /// @notice Truncate `input` to the `bits` least significant bits.\\n function truncate(uint256 bits, uint256 input)\\n internal\\n pure\\n returns (uint256)\\n {\\n unchecked {\\n return input & ((1 << bits) - 1);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x67f87f589cd5123ffa32f883ea2f09b0e56258508bae82b8c655b3c27c71eb5e\"},\"@keep-network/sortition-pools/contracts/Rewards.sol\":{\"content\":\"pragma solidity 0.8.17;\\n\\n/// @title Rewards\\n/// @notice Rewards are allocated proportionally to operators\\n/// present in the pool at payout based on their weight in the pool.\\n///\\n/// To facilitate this, we use a global accumulator value\\n/// to track the total rewards one unit of weight would've earned\\n/// since the creation of the pool.\\n///\\n/// Whenever a reward is paid, the accumulator is increased\\n/// by the size of the reward divided by the total weight\\n/// of all eligible operators in the pool.\\n///\\n/// Each operator has an individual accumulator value,\\n/// set to equal the global accumulator when the operator joins the pool.\\n/// This accumulator reflects the amount of rewards\\n/// that have already been accounted for with that operator.\\n///\\n/// Whenever an operator's weight in the pool changes,\\n/// we can update the amount of rewards the operator has earned\\n/// by subtracting the operator's accumulator from the global accumulator.\\n/// This gives us the amount of rewards one unit of weight has earned\\n/// since the last time the operator's rewards have been updated.\\n/// Then we multiply that by the operator's previous (pre-change) weight\\n/// to determine how much rewards in total the operator has earned,\\n/// and add this to the operator's earned rewards.\\n/// Finally, we set the operator's accumulator to the global accumulator value.\\ncontract Rewards {\\n struct OperatorRewards {\\n // The state of the global accumulator\\n // when the operator's rewards were last updated\\n uint96 accumulated;\\n // The amount of rewards collected by the operator after the latest update.\\n // The amount the operator could withdraw may equal `available`\\n // or it may be greater, if more rewards have been paid in since then.\\n // To evaulate the most recent amount including rewards potentially paid\\n // since the last update, use `availableRewards` function.\\n uint96 available;\\n // If nonzero, the operator is ineligible for rewards\\n // and may only re-enable rewards after the specified timestamp.\\n // XXX: unsigned 32-bit integer unix seconds, will break around 2106\\n uint32 ineligibleUntil;\\n // Locally cached weight of the operator,\\n // used to reduce the cost of setting operators ineligible.\\n uint32 weight;\\n }\\n\\n // The global accumulator of how much rewards\\n // a hypothetical operator of weight 1 would have earned\\n // since the creation of the pool.\\n uint96 internal globalRewardAccumulator;\\n // If the amount of reward tokens paid in\\n // does not divide cleanly by pool weight,\\n // the difference is recorded as rounding dust\\n // and added to the next reward.\\n uint96 internal rewardRoundingDust;\\n\\n // The amount of rewards that would've been earned by ineligible operators\\n // had they not been ineligible.\\n uint96 public ineligibleEarnedRewards;\\n\\n // Ineligibility times are calculated from this offset,\\n // set at contract creation.\\n uint256 internal immutable ineligibleOffsetStart;\\n\\n mapping(uint32 => OperatorRewards) internal operatorRewards;\\n\\n constructor() {\\n // solhint-disable-next-line not-rely-on-time\\n ineligibleOffsetStart = block.timestamp;\\n }\\n\\n /// @notice Return whether the operator is eligible for rewards or not.\\n function isEligibleForRewards(uint32 operator) internal view returns (bool) {\\n return operatorRewards[operator].ineligibleUntil == 0;\\n }\\n\\n /// @notice Return the time the operator's reward eligibility can be restored.\\n function rewardsEligibilityRestorableAt(uint32 operator)\\n internal\\n view\\n returns (uint256)\\n {\\n uint32 until = operatorRewards[operator].ineligibleUntil;\\n require(until != 0, \\\"Operator already eligible\\\");\\n return (uint256(until) + ineligibleOffsetStart);\\n }\\n\\n /// @notice Return whether the operator is able to restore their eligibility\\n /// for rewards right away.\\n function canRestoreRewardEligibility(uint32 operator)\\n internal\\n view\\n returns (bool)\\n {\\n // solhint-disable-next-line not-rely-on-time\\n return rewardsEligibilityRestorableAt(operator) <= block.timestamp;\\n }\\n\\n /// @notice Internal function for updating the global state of rewards.\\n function addRewards(uint96 rewardAmount, uint32 currentPoolWeight) internal {\\n require(currentPoolWeight > 0, \\\"No recipients in pool\\\");\\n\\n uint96 totalAmount = rewardAmount + rewardRoundingDust;\\n uint96 perWeightReward = totalAmount / currentPoolWeight;\\n uint96 newRoundingDust = totalAmount % currentPoolWeight;\\n\\n globalRewardAccumulator += perWeightReward;\\n rewardRoundingDust = newRoundingDust;\\n }\\n\\n /// @notice Internal function for updating the operator's reward state.\\n function updateOperatorRewards(uint32 operator, uint32 newWeight) internal {\\n uint96 acc = globalRewardAccumulator;\\n OperatorRewards memory o = operatorRewards[operator];\\n uint96 accruedRewards = (acc - o.accumulated) * uint96(o.weight);\\n if (o.ineligibleUntil == 0) {\\n // If operator is not ineligible, update their earned rewards\\n o.available += accruedRewards;\\n } else {\\n // If ineligible, put the rewards into the ineligible pot\\n ineligibleEarnedRewards += accruedRewards;\\n }\\n // In any case, update their accumulator and weight\\n o.accumulated = acc;\\n o.weight = newWeight;\\n operatorRewards[operator] = o;\\n }\\n\\n /// @notice Set the amount of withdrawable tokens to zero\\n /// and return the previous withdrawable amount.\\n /// @dev Does not update the withdrawable amount,\\n /// but should usually be accompanied by an update.\\n function withdrawOperatorRewards(uint32 operator)\\n internal\\n returns (uint96 withdrawable)\\n {\\n OperatorRewards storage o = operatorRewards[operator];\\n withdrawable = o.available;\\n o.available = 0;\\n }\\n\\n /// @notice Set the amount of ineligible-earned tokens to zero\\n /// and return the previous amount.\\n function withdrawIneligibleRewards() internal returns (uint96 withdrawable) {\\n withdrawable = ineligibleEarnedRewards;\\n ineligibleEarnedRewards = 0;\\n }\\n\\n /// @notice Set the given operators as ineligible for rewards.\\n /// The operators can restore their eligibility at the given time.\\n function setIneligible(uint32[] memory operators, uint256 until) internal {\\n OperatorRewards memory o = OperatorRewards(0, 0, 0, 0);\\n uint96 globalAcc = globalRewardAccumulator;\\n uint96 accrued = 0;\\n // Record ineligibility as seconds after contract creation\\n uint32 _until = uint32(until - ineligibleOffsetStart);\\n\\n for (uint256 i = 0; i < operators.length; i++) {\\n uint32 operator = operators[i];\\n OperatorRewards storage r = operatorRewards[operator];\\n o.available = r.available;\\n o.accumulated = r.accumulated;\\n o.ineligibleUntil = r.ineligibleUntil;\\n o.weight = r.weight;\\n\\n if (o.ineligibleUntil != 0) {\\n // If operator is already ineligible,\\n // don't earn rewards or shorten its ineligibility\\n if (o.ineligibleUntil < _until) {\\n o.ineligibleUntil = _until;\\n }\\n } else {\\n // The operator becomes ineligible -> earn rewards\\n o.ineligibleUntil = _until;\\n accrued = (globalAcc - o.accumulated) * uint96(o.weight);\\n o.available += accrued;\\n }\\n o.accumulated = globalAcc;\\n\\n r.available = o.available;\\n r.accumulated = o.accumulated;\\n r.ineligibleUntil = o.ineligibleUntil;\\n r.weight = o.weight;\\n }\\n }\\n\\n /// @notice Restore the given operator's eligibility for rewards.\\n function restoreEligibility(uint32 operator) internal {\\n // solhint-disable-next-line not-rely-on-time\\n require(canRestoreRewardEligibility(operator), \\\"Operator still ineligible\\\");\\n uint96 acc = globalRewardAccumulator;\\n OperatorRewards memory o = operatorRewards[operator];\\n uint96 accruedRewards = (acc - o.accumulated) * uint96(o.weight);\\n ineligibleEarnedRewards += accruedRewards;\\n o.accumulated = acc;\\n o.ineligibleUntil = 0;\\n operatorRewards[operator] = o;\\n }\\n\\n /// @notice Returns the amount of rewards currently available for withdrawal\\n /// for the given operator.\\n function availableRewards(uint32 operator) internal view returns (uint96) {\\n uint96 acc = globalRewardAccumulator;\\n OperatorRewards memory o = operatorRewards[operator];\\n if (o.ineligibleUntil == 0) {\\n // If operator is not ineligible, calculate newly accrued rewards and add\\n // them to the available ones, calculated during the last update.\\n uint96 accruedRewards = (acc - o.accumulated) * uint96(o.weight);\\n return o.available + accruedRewards;\\n } else {\\n // If ineligible, return only the rewards calculated during the last\\n // update.\\n return o.available;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3a10abb408b44335a092387b2c7ee01db3b27997f1f2c888d9b7a2d92934c4e2\"},\"@keep-network/sortition-pools/contracts/SortitionPool.sol\":{\"content\":\"pragma solidity 0.8.17;\\n\\nimport \\\"@thesis/solidity-contracts/contracts/token/IERC20WithPermit.sol\\\";\\nimport \\\"@thesis/solidity-contracts/contracts/token/IReceiveApproval.sol\\\";\\n\\nimport \\\"@openzeppelin/contracts/access/Ownable.sol\\\";\\n\\nimport \\\"./RNG.sol\\\";\\nimport \\\"./SortitionTree.sol\\\";\\nimport \\\"./Rewards.sol\\\";\\nimport \\\"./Chaosnet.sol\\\";\\n\\n/// @title Sortition Pool\\n/// @notice A logarithmic data structure used to store the pool of eligible\\n/// operators weighted by their stakes. It allows to select a group of operators\\n/// based on the provided pseudo-random seed.\\ncontract SortitionPool is\\n SortitionTree,\\n Rewards,\\n Ownable,\\n Chaosnet,\\n IReceiveApproval\\n{\\n using Branch for uint256;\\n using Leaf for uint256;\\n using Position for uint256;\\n\\n IERC20WithPermit public immutable rewardToken;\\n\\n uint256 public immutable poolWeightDivisor;\\n\\n bool public isLocked;\\n\\n event IneligibleForRewards(uint32[] ids, uint256 until);\\n\\n event RewardEligibilityRestored(address indexed operator, uint32 indexed id);\\n\\n /// @notice Reverts if called while pool is locked.\\n modifier onlyUnlocked() {\\n require(!isLocked, \\\"Sortition pool locked\\\");\\n _;\\n }\\n\\n /// @notice Reverts if called while pool is unlocked.\\n modifier onlyLocked() {\\n require(isLocked, \\\"Sortition pool unlocked\\\");\\n _;\\n }\\n\\n constructor(IERC20WithPermit _rewardToken, uint256 _poolWeightDivisor) {\\n rewardToken = _rewardToken;\\n poolWeightDivisor = _poolWeightDivisor;\\n }\\n\\n function receiveApproval(\\n address sender,\\n uint256 amount,\\n address token,\\n bytes calldata\\n ) external override {\\n require(token == address(rewardToken), \\\"Unsupported token\\\");\\n rewardToken.transferFrom(sender, address(this), amount);\\n Rewards.addRewards(uint96(amount), uint32(root.sumWeight()));\\n }\\n\\n /// @notice Withdraws all available rewards for the given operator to the\\n /// given beneficiary.\\n /// @dev Can be called only be the owner. Does not validate if the provided\\n /// beneficiary is associated with the provided operator - this needs to\\n /// be done by the owner calling this function.\\n /// @return The amount of rewards withdrawn in this call.\\n function withdrawRewards(address operator, address beneficiary)\\n public\\n onlyOwner\\n returns (uint96)\\n {\\n uint32 id = getOperatorID(operator);\\n Rewards.updateOperatorRewards(id, uint32(getPoolWeight(operator)));\\n uint96 earned = Rewards.withdrawOperatorRewards(id);\\n rewardToken.transfer(beneficiary, uint256(earned));\\n return earned;\\n }\\n\\n /// @notice Withdraws rewards not allocated to operators marked as ineligible\\n /// to the given recipient address.\\n /// @dev Can be called only by the owner.\\n function withdrawIneligible(address recipient) public onlyOwner {\\n uint96 earned = Rewards.withdrawIneligibleRewards();\\n rewardToken.transfer(recipient, uint256(earned));\\n }\\n\\n /// @notice Locks the sortition pool. In locked state, members cannot be\\n /// inserted and removed from the pool. Members statuses cannot\\n /// be updated as well.\\n /// @dev Can be called only by the contract owner.\\n function lock() public onlyOwner {\\n isLocked = true;\\n }\\n\\n /// @notice Unlocks the sortition pool. Removes all restrictions set by\\n /// the `lock` method.\\n /// @dev Can be called only by the contract owner.\\n function unlock() public onlyOwner {\\n isLocked = false;\\n }\\n\\n /// @notice Inserts an operator to the pool. Reverts if the operator is\\n /// already present. Reverts if the operator is not eligible because of their\\n /// authorized stake. Reverts if the chaosnet is active and the operator is\\n /// not a beta operator.\\n /// @dev Can be called only by the contract owner.\\n /// @param operator Address of the inserted operator.\\n /// @param authorizedStake Inserted operator's authorized stake for the application.\\n function insertOperator(address operator, uint256 authorizedStake)\\n public\\n onlyOwner\\n onlyUnlocked\\n {\\n uint256 weight = getWeight(authorizedStake);\\n require(weight > 0, \\\"Operator not eligible\\\");\\n\\n if (isChaosnetActive) {\\n require(isBetaOperator[operator], \\\"Not beta operator for chaosnet\\\");\\n }\\n\\n _insertOperator(operator, weight);\\n uint32 id = getOperatorID(operator);\\n Rewards.updateOperatorRewards(id, uint32(weight));\\n }\\n\\n /// @notice Update the operator's weight if present and eligible,\\n /// or remove from the pool if present and ineligible.\\n /// @dev Can be called only by the contract owner.\\n /// @param operator Address of the updated operator.\\n /// @param authorizedStake Operator's authorized stake for the application.\\n function updateOperatorStatus(address operator, uint256 authorizedStake)\\n public\\n onlyOwner\\n onlyUnlocked\\n {\\n uint256 weight = getWeight(authorizedStake);\\n\\n uint32 id = getOperatorID(operator);\\n Rewards.updateOperatorRewards(id, uint32(weight));\\n\\n if (weight == 0) {\\n _removeOperator(operator);\\n } else {\\n updateOperator(operator, weight);\\n }\\n }\\n\\n /// @notice Set the given operators as ineligible for rewards.\\n /// The operators can restore their eligibility at the given time.\\n function setRewardIneligibility(uint32[] calldata operators, uint256 until)\\n public\\n onlyOwner\\n {\\n Rewards.setIneligible(operators, until);\\n emit IneligibleForRewards(operators, until);\\n }\\n\\n /// @notice Restores reward eligibility for the operator.\\n function restoreRewardEligibility(address operator) public {\\n uint32 id = getOperatorID(operator);\\n Rewards.restoreEligibility(id);\\n emit RewardEligibilityRestored(operator, id);\\n }\\n\\n /// @notice Returns whether the operator is eligible for rewards or not.\\n function isEligibleForRewards(address operator) public view returns (bool) {\\n uint32 id = getOperatorID(operator);\\n return Rewards.isEligibleForRewards(id);\\n }\\n\\n /// @notice Returns the time the operator's reward eligibility can be restored.\\n function rewardsEligibilityRestorableAt(address operator)\\n public\\n view\\n returns (uint256)\\n {\\n uint32 id = getOperatorID(operator);\\n return Rewards.rewardsEligibilityRestorableAt(id);\\n }\\n\\n /// @notice Returns whether the operator is able to restore their eligibility\\n /// for rewards right away.\\n function canRestoreRewardEligibility(address operator)\\n public\\n view\\n returns (bool)\\n {\\n uint32 id = getOperatorID(operator);\\n return Rewards.canRestoreRewardEligibility(id);\\n }\\n\\n /// @notice Returns the amount of rewards withdrawable for the given operator.\\n function getAvailableRewards(address operator) public view returns (uint96) {\\n uint32 id = getOperatorID(operator);\\n return availableRewards(id);\\n }\\n\\n /// @notice Return whether the operator is present in the pool.\\n function isOperatorInPool(address operator) public view returns (bool) {\\n return getFlaggedLeafPosition(operator) != 0;\\n }\\n\\n /// @notice Return whether the operator's weight in the pool\\n /// matches their eligible weight.\\n function isOperatorUpToDate(address operator, uint256 authorizedStake)\\n public\\n view\\n returns (bool)\\n {\\n return getWeight(authorizedStake) == getPoolWeight(operator);\\n }\\n\\n /// @notice Return the weight of the operator in the pool,\\n /// which may or may not be out of date.\\n function getPoolWeight(address operator) public view returns (uint256) {\\n uint256 flaggedPosition = getFlaggedLeafPosition(operator);\\n if (flaggedPosition == 0) {\\n return 0;\\n } else {\\n uint256 leafPosition = flaggedPosition.unsetFlag();\\n uint256 leafWeight = getLeafWeight(leafPosition);\\n return leafWeight;\\n }\\n }\\n\\n /// @notice Selects a new group of operators of the provided size based on\\n /// the provided pseudo-random seed. At least one operator has to be\\n /// registered in the pool, otherwise the function fails reverting the\\n /// transaction.\\n /// @param groupSize Size of the requested group\\n /// @param seed Pseudo-random number used to select operators to group\\n /// @return selected Members of the selected group\\n function selectGroup(uint256 groupSize, bytes32 seed)\\n public\\n view\\n onlyLocked\\n returns (uint32[] memory)\\n {\\n uint256 _root = root;\\n\\n bytes32 rngState = seed;\\n uint256 rngRange = _root.sumWeight();\\n require(rngRange > 0, \\\"Not enough operators in pool\\\");\\n uint256 currentIndex;\\n\\n uint256 bits = RNG.bitsRequired(rngRange);\\n\\n uint32[] memory selected = new uint32[](groupSize);\\n\\n for (uint256 i = 0; i < groupSize; i++) {\\n (currentIndex, rngState) = RNG.getIndex(rngRange, rngState, bits);\\n\\n uint256 leafPosition = pickWeightedLeaf(currentIndex, _root);\\n\\n uint256 leaf = leaves[leafPosition];\\n selected[i] = leaf.id();\\n }\\n return selected;\\n }\\n\\n function getWeight(uint256 authorization) internal view returns (uint256) {\\n return authorization / poolWeightDivisor;\\n }\\n}\\n\",\"keccak256\":\"0xab42e7c5b1828f42a73f699eb2dc96d4f793572a6323b8b1fbd7c5e0c065bda7\"},\"@keep-network/sortition-pools/contracts/SortitionTree.sol\":{\"content\":\"pragma solidity 0.8.17;\\n\\nimport \\\"./Branch.sol\\\";\\nimport \\\"./Position.sol\\\";\\nimport \\\"./Leaf.sol\\\";\\nimport \\\"./Constants.sol\\\";\\n\\ncontract SortitionTree {\\n using Branch for uint256;\\n using Position for uint256;\\n using Leaf for uint256;\\n\\n // implicit tree\\n // root 8\\n // level2 64\\n // level3 512\\n // level4 4k\\n // level5 32k\\n // level6 256k\\n // level7 2M\\n uint256 internal root;\\n\\n // A 2-index mapping from layer => (index (0-index) => branch). For example,\\n // to access the 6th branch in the 2nd layer (right below the root node; the\\n // first branch layer), call branches[2][5]. Mappings are used in place of\\n // arrays for efficiency. The root is the first layer, the branches occupy\\n // layers 2 through 7, and layer 8 is for the leaves. Following this\\n // convention, the first index in `branches` is `2`, and the last index is\\n // `7`.\\n mapping(uint256 => mapping(uint256 => uint256)) internal branches;\\n\\n // A 0-index mapping from index => leaf, acting as an array. For example, to\\n // access the 42nd leaf, call leaves[41].\\n mapping(uint256 => uint256) internal leaves;\\n\\n // the flagged (see setFlag() and unsetFlag() in Position.sol) positions\\n // of all operators present in the pool\\n mapping(address => uint256) internal flaggedLeafPosition;\\n\\n // the leaf after the rightmost occupied leaf of each stack\\n uint256 internal rightmostLeaf;\\n\\n // the empty leaves in each stack\\n // between 0 and the rightmost occupied leaf\\n uint256[] internal emptyLeaves;\\n\\n // Each operator has an uint32 ID number\\n // which is allocated when they first join the pool\\n // and remains unchanged even if they leave and rejoin the pool.\\n mapping(address => uint32) internal operatorID;\\n\\n // The idAddress array records the address corresponding to each ID number.\\n // The ID number 0 is initialized with a zero address and is not used.\\n address[] internal idAddress;\\n\\n constructor() {\\n root = 0;\\n rightmostLeaf = 0;\\n idAddress.push();\\n }\\n\\n /// @notice Return the ID number of the given operator address. An ID number\\n /// of 0 means the operator has not been allocated an ID number yet.\\n /// @param operator Address of the operator.\\n /// @return the ID number of the given operator address\\n function getOperatorID(address operator) public view returns (uint32) {\\n return operatorID[operator];\\n }\\n\\n /// @notice Get the operator address corresponding to the given ID number. A\\n /// zero address means the ID number has not been allocated yet.\\n /// @param id ID of the operator\\n /// @return the address of the operator\\n function getIDOperator(uint32 id) public view returns (address) {\\n return idAddress.length > id ? idAddress[id] : address(0);\\n }\\n\\n /// @notice Gets the operator addresses corresponding to the given ID\\n /// numbers. A zero address means the ID number has not been allocated yet.\\n /// This function works just like getIDOperator except that it allows to fetch\\n /// operator addresses for multiple IDs in one call.\\n /// @param ids the array of the operator ids\\n /// @return an array of the associated operator addresses\\n function getIDOperators(uint32[] calldata ids)\\n public\\n view\\n returns (address[] memory)\\n {\\n uint256 idCount = idAddress.length;\\n\\n address[] memory operators = new address[](ids.length);\\n for (uint256 i = 0; i < ids.length; i++) {\\n uint32 id = ids[i];\\n operators[i] = idCount > id ? idAddress[id] : address(0);\\n }\\n return operators;\\n }\\n\\n /// @notice Checks if operator is already registered in the pool.\\n /// @param operator the address of the operator\\n /// @return whether or not the operator is already registered in the pool\\n function isOperatorRegistered(address operator) public view returns (bool) {\\n return getFlaggedLeafPosition(operator) != 0;\\n }\\n\\n /// @notice Sum the number of operators in each trunk.\\n /// @return the number of operators in the pool\\n function operatorsInPool() public view returns (uint256) {\\n // Get the number of leaves that might be occupied;\\n // if `rightmostLeaf` equals `firstLeaf()` the tree must be empty,\\n // otherwise the difference between these numbers\\n // gives the number of leaves that may be occupied.\\n uint256 nPossiblyUsedLeaves = rightmostLeaf;\\n // Get the number of empty leaves\\n // not accounted for by the `rightmostLeaf`\\n uint256 nEmptyLeaves = emptyLeaves.length;\\n\\n return (nPossiblyUsedLeaves - nEmptyLeaves);\\n }\\n\\n /// @notice Convenience method to return the total weight of the pool\\n /// @return the total weight of the pool\\n function totalWeight() public view returns (uint256) {\\n return root.sumWeight();\\n }\\n\\n /// @notice Give the operator a new ID number.\\n /// Does not check if the operator already has an ID number.\\n /// @param operator the address of the operator\\n /// @return a new ID for that operator\\n function allocateOperatorID(address operator) internal returns (uint256) {\\n uint256 id = idAddress.length;\\n\\n require(id <= type(uint32).max, \\\"Pool capacity exceeded\\\");\\n\\n operatorID[operator] = uint32(id);\\n idAddress.push(operator);\\n return id;\\n }\\n\\n /// @notice Inserts an operator into the sortition pool\\n /// @param operator the address of an operator to insert\\n /// @param weight how much weight that operator has in the pool\\n function _insertOperator(address operator, uint256 weight) internal {\\n require(\\n !isOperatorRegistered(operator),\\n \\\"Operator is already registered in the pool\\\"\\n );\\n\\n // Fetch the operator's ID, and if they don't have one, allocate them one.\\n uint256 id = getOperatorID(operator);\\n if (id == 0) {\\n id = allocateOperatorID(operator);\\n }\\n\\n // Determine which leaf to insert them into\\n uint256 position = getEmptyLeafPosition();\\n // Record the block the operator was inserted in\\n uint256 theLeaf = Leaf.make(operator, block.number, id);\\n\\n // Update the leaf, and propagate the weight changes all the way up to the\\n // root.\\n root = setLeaf(position, theLeaf, weight, root);\\n\\n // Without position flags,\\n // the position 0x000000 would be treated as empty\\n flaggedLeafPosition[operator] = position.setFlag();\\n }\\n\\n /// @notice Remove an operator (and their weight) from the pool.\\n /// @param operator the address of the operator to remove\\n function _removeOperator(address operator) internal {\\n uint256 flaggedPosition = getFlaggedLeafPosition(operator);\\n require(flaggedPosition != 0, \\\"Operator is not registered in the pool\\\");\\n uint256 unflaggedPosition = flaggedPosition.unsetFlag();\\n\\n // Update the leaf, and propagate the weight changes all the way up to the\\n // root.\\n root = removeLeaf(unflaggedPosition, root);\\n removeLeafPositionRecord(operator);\\n }\\n\\n /// @notice Update an operator's weight in the pool.\\n /// @param operator the address of the operator to update\\n /// @param weight the new weight\\n function updateOperator(address operator, uint256 weight) internal {\\n require(\\n isOperatorRegistered(operator),\\n \\\"Operator is not registered in the pool\\\"\\n );\\n\\n uint256 flaggedPosition = getFlaggedLeafPosition(operator);\\n uint256 unflaggedPosition = flaggedPosition.unsetFlag();\\n root = updateLeaf(unflaggedPosition, weight, root);\\n }\\n\\n /// @notice Helper method to remove a leaf position record for an operator.\\n /// @param operator the address of the operator to remove the record for\\n function removeLeafPositionRecord(address operator) internal {\\n flaggedLeafPosition[operator] = 0;\\n }\\n\\n /// @notice Removes the data and weight from a particular leaf.\\n /// @param position the leaf index to remove\\n /// @param _root the root node containing the leaf\\n /// @return the updated root node\\n function removeLeaf(uint256 position, uint256 _root)\\n internal\\n returns (uint256)\\n {\\n uint256 rightmostSubOne = rightmostLeaf - 1;\\n bool isRightmost = position == rightmostSubOne;\\n\\n // Clears out the data in the leaf node, and then propagates the weight\\n // changes all the way up to the root.\\n uint256 newRoot = setLeaf(position, 0, 0, _root);\\n\\n // Infer if need to fall back on emptyLeaves yet\\n if (isRightmost) {\\n rightmostLeaf = rightmostSubOne;\\n } else {\\n emptyLeaves.push(position);\\n }\\n return newRoot;\\n }\\n\\n /// @notice Updates the tree to give a particular leaf a new weight.\\n /// @param position the index of the leaf to update\\n /// @param weight the new weight\\n /// @param _root the root node containing the leaf\\n /// @return the updated root node\\n function updateLeaf(\\n uint256 position,\\n uint256 weight,\\n uint256 _root\\n ) internal returns (uint256) {\\n if (getLeafWeight(position) != weight) {\\n return updateTree(position, weight, _root);\\n } else {\\n return _root;\\n }\\n }\\n\\n /// @notice Places a leaf into a particular position, with a given weight and\\n /// propagates that change.\\n /// @param position the index to place the leaf in\\n /// @param theLeaf the new leaf to place in the position\\n /// @param leafWeight the weight of the leaf\\n /// @param _root the root containing the new leaf\\n /// @return the updated root node\\n function setLeaf(\\n uint256 position,\\n uint256 theLeaf,\\n uint256 leafWeight,\\n uint256 _root\\n ) internal returns (uint256) {\\n // set leaf\\n leaves[position] = theLeaf;\\n\\n return (updateTree(position, leafWeight, _root));\\n }\\n\\n /// @notice Propagates a weight change at a position through the tree,\\n /// eventually returning the updated root.\\n /// @param position the index of leaf to update\\n /// @param weight the new weight of the leaf\\n /// @param _root the root node containing the leaf\\n /// @return the updated root node\\n function updateTree(\\n uint256 position,\\n uint256 weight,\\n uint256 _root\\n ) internal returns (uint256) {\\n uint256 childSlot;\\n uint256 treeNode;\\n uint256 newNode;\\n uint256 nodeWeight = weight;\\n\\n uint256 parent = position;\\n // set levels 7 to 2\\n for (uint256 level = Constants.LEVELS; level >= 2; level--) {\\n childSlot = parent.slot();\\n parent = parent.parent();\\n treeNode = branches[level][parent];\\n newNode = treeNode.setSlot(childSlot, nodeWeight);\\n branches[level][parent] = newNode;\\n nodeWeight = newNode.sumWeight();\\n }\\n\\n // set level Root\\n childSlot = parent.slot();\\n return _root.setSlot(childSlot, nodeWeight);\\n }\\n\\n /// @notice Retrieves the next available empty leaf position. Tries to fill\\n /// left to right first, ignoring leaf removals, and then fills\\n /// most-recent-removals first.\\n /// @return the position of the empty leaf\\n function getEmptyLeafPosition() internal returns (uint256) {\\n uint256 rLeaf = rightmostLeaf;\\n bool spaceOnRight = (rLeaf + 1) < Constants.POOL_CAPACITY;\\n if (spaceOnRight) {\\n rightmostLeaf = rLeaf + 1;\\n return rLeaf;\\n } else {\\n uint256 emptyLeafCount = emptyLeaves.length;\\n require(emptyLeafCount > 0, \\\"Pool is full\\\");\\n uint256 emptyLeaf = emptyLeaves[emptyLeafCount - 1];\\n emptyLeaves.pop();\\n return emptyLeaf;\\n }\\n }\\n\\n /// @notice Gets the flagged leaf position for an operator.\\n /// @param operator the address of the operator\\n /// @return the leaf position of that operator\\n function getFlaggedLeafPosition(address operator)\\n internal\\n view\\n returns (uint256)\\n {\\n return flaggedLeafPosition[operator];\\n }\\n\\n /// @notice Gets the weight of a leaf at a particular position.\\n /// @param position the index of the leaf\\n /// @return the weight of the leaf at that position\\n function getLeafWeight(uint256 position) internal view returns (uint256) {\\n uint256 slot = position.slot();\\n uint256 parent = position.parent();\\n\\n // A leaf's weight information is stored a 32-bit slot in the branch layer\\n // directly above the leaf layer. To access it, we calculate that slot and\\n // parent position, and always know the hard-coded layer index.\\n uint256 node = branches[Constants.LEVELS][parent];\\n return node.getSlot(slot);\\n }\\n\\n /// @notice Picks a leaf given a random index.\\n /// @param index a number in `[0, _root.totalWeight())` used to decide\\n /// between leaves\\n /// @param _root the root of the tree\\n function pickWeightedLeaf(uint256 index, uint256 _root)\\n internal\\n view\\n returns (uint256 leafPosition)\\n {\\n uint256 currentIndex = index;\\n uint256 currentNode = _root;\\n uint256 currentPosition = 0;\\n uint256 currentSlot;\\n\\n require(index < currentNode.sumWeight(), \\\"Index exceeds weight\\\");\\n\\n // get root slot\\n (currentSlot, currentIndex) = currentNode.pickWeightedSlot(currentIndex);\\n\\n // get slots from levels 2 to 7\\n for (uint256 level = 2; level <= Constants.LEVELS; level++) {\\n currentPosition = currentPosition.child(currentSlot);\\n currentNode = branches[level][currentPosition];\\n (currentSlot, currentIndex) = currentNode.pickWeightedSlot(currentIndex);\\n }\\n\\n // get leaf position\\n leafPosition = currentPosition.child(currentSlot);\\n }\\n}\\n\",\"keccak256\":\"0x51daeca62ef52be78a1a9de4d2a1c5900c873165f59eda14d5965d7d7da90a03\"},\"@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\",\"keccak256\":\"0xa94b34880e3c1b0b931662cb1c09e5dfa6662f31cba80e07c5ee71cd135c9673\",\"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/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\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"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/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\"},\"@thesis/solidity-contracts/contracts/token/IApproveAndCall.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.4;\\n\\n/// @notice An interface that should be implemented by tokens supporting\\n/// `approveAndCall`/`receiveApproval` pattern.\\ninterface IApproveAndCall {\\n /// @notice Executes `receiveApproval` function on spender as specified in\\n /// `IReceiveApproval` interface. Approves spender to withdraw from\\n /// the caller multiple times, up to the `amount`. If this\\n /// function is called again, it overwrites the current allowance\\n /// with `amount`. Reverts if the approval reverted or if\\n /// `receiveApproval` call on the spender reverted.\\n function approveAndCall(\\n address spender,\\n uint256 amount,\\n bytes memory extraData\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x393d18ef81a57dcc96fff4c340cc2945deaebb37b9796c322cf2bc96872c3df8\",\"license\":\"MIT\"},\"@thesis/solidity-contracts/contracts/token/IERC20WithPermit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.4;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\\\";\\n\\nimport \\\"./IApproveAndCall.sol\\\";\\n\\n/// @title IERC20WithPermit\\n/// @notice Burnable ERC20 token with EIP2612 permit functionality. User can\\n/// authorize a transfer of their token with a signature conforming\\n/// EIP712 standard instead of an on-chain transaction from their\\n/// address. Anyone can submit this signature on the user's behalf by\\n/// calling the permit function, as specified in EIP2612 standard,\\n/// paying gas fees, and possibly performing other actions in the same\\n/// transaction.\\ninterface IERC20WithPermit is IERC20, IERC20Metadata, IApproveAndCall {\\n /// @notice EIP2612 approval made with secp256k1 signature.\\n /// Users can authorize a transfer of their tokens with a signature\\n /// conforming EIP712 standard, rather than an on-chain transaction\\n /// from their address. Anyone can submit this signature on the\\n /// user's behalf by calling the permit function, paying gas fees,\\n /// and possibly performing other actions in the same transaction.\\n /// @dev The deadline argument can be set to `type(uint256).max to create\\n /// permits that effectively never expire.\\n function permit(\\n address owner,\\n address spender,\\n uint256 amount,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /// @notice Destroys `amount` tokens from the caller.\\n function burn(uint256 amount) external;\\n\\n /// @notice Destroys `amount` of tokens from `account`, deducting the amount\\n /// from caller's allowance.\\n function burnFrom(address account, uint256 amount) external;\\n\\n /// @notice Returns hash of EIP712 Domain struct with the token name as\\n /// a signing domain and token contract as a verifying contract.\\n /// Used to construct EIP2612 signature provided to `permit`\\n /// function.\\n /* solhint-disable-next-line func-name-mixedcase */\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n\\n /// @notice Returns the current nonce for EIP2612 permission for the\\n /// provided token owner for a replay protection. Used to construct\\n /// EIP2612 signature provided to `permit` function.\\n function nonce(address owner) external view returns (uint256);\\n\\n /// @notice Returns EIP2612 Permit message hash. Used to construct EIP2612\\n /// signature provided to `permit` function.\\n /* solhint-disable-next-line func-name-mixedcase */\\n function PERMIT_TYPEHASH() external pure returns (bytes32);\\n}\\n\",\"keccak256\":\"0xdac9a5086c19a7128b505a7be1ab0ac1aa314f6989cb88d2417e9d7383f89fa9\",\"license\":\"MIT\"},\"@thesis/solidity-contracts/contracts/token/IReceiveApproval.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.4;\\n\\n/// @notice An interface that should be implemented by contracts supporting\\n/// `approveAndCall`/`receiveApproval` pattern.\\ninterface IReceiveApproval {\\n /// @notice Receives approval to spend tokens. Called as a result of\\n /// `approveAndCall` call on the token.\\n function receiveApproval(\\n address from,\\n uint256 amount,\\n address token,\\n bytes calldata extraData\\n ) external;\\n}\\n\",\"keccak256\":\"0x6a30d83ad230548b1e7839737affc8489a035314209de14b89dbef7fb0f66395\",\"license\":\"MIT\"},\"contracts/BeaconDkgValidator.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\n//\\n// \\u2593\\u2593\\u258c \\u2593\\u2593 \\u2590\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u258c\\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2584\\n// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u258c\\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\n// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2580 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u258c \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\n// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2584\\u2584\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2580 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2584\\u2584\\u2584\\u2584 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2584\\u2584\\u2584\\u2584 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u258c \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\n// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2580 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\n// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2580\\u2580\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2584 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2580\\u2580\\u2580\\u2580 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2580\\u2580\\u2580\\u2580 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2580\\n// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2580\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2584 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u258c\\n// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2588\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\n// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\n//\\n// Trust math, not hardware.\\n\\npragma solidity 0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\nimport \\\"@keep-network/sortition-pools/contracts/SortitionPool.sol\\\";\\nimport \\\"./libraries/BytesLib.sol\\\";\\nimport {BeaconDkg as DKG} from \\\"./libraries/BeaconDkg.sol\\\";\\n\\n/// @title DKG result validator\\n/// @notice DKGValidator allows performing a full validation of DKG result,\\n/// including checking the format of fields in the result, declared\\n/// selected group members, and signatures of operators supporting the\\n/// result. The operator submitting the result should perform the\\n/// validation using a free contract call before submitting the result\\n/// to ensure their result is valid and can not be challenged. All other\\n/// network operators should perform validation of the submitted result\\n/// using a free contract call and challenge the result if the\\n/// validation fails.\\ncontract BeaconDkgValidator {\\n using BytesLib for bytes;\\n using ECDSA for bytes32;\\n\\n /// @dev Size of a group in the threshold relay.\\n uint256 public constant groupSize = 64;\\n\\n /// @dev The minimum number of group members needed to interact according to\\n /// the protocol to produce a relay entry. The adversary can not learn\\n /// anything about the key as long as it does not break into\\n /// groupThreshold+1 of members.\\n uint256 public constant groupThreshold = 33;\\n\\n /// @dev The minimum number of active and properly behaving group members\\n /// during the DKG needed to accept the result. This number is higher\\n /// than `groupThreshold` to keep a safety margin for members becoming\\n /// inactive after DKG so that the group can still produce a relay\\n /// entry.\\n uint256 public constant activeThreshold = 58; // 90% of groupSize\\n\\n /// @dev Size in bytes of a single signature produced by operator supporting\\n /// DKG result.\\n uint256 public constant signatureByteSize = 65;\\n\\n SortitionPool public immutable sortitionPool;\\n\\n constructor(SortitionPool _sortitionPool) {\\n require(\\n address(_sortitionPool) != address(0),\\n \\\"Zero-address reference\\\"\\n );\\n\\n sortitionPool = _sortitionPool;\\n }\\n\\n /// @notice Performs a full validation of DKG result, including checking the\\n /// format of fields in the result, declared selected group members,\\n /// and signatures of operators supporting the result.\\n /// @param seed seed used to start the DKG and select group members\\n /// @param startBlock DKG start block\\n /// @return isValid true if the result is valid, false otherwise\\n /// @return errorMsg validation error message; empty for a valid result\\n function validate(\\n DKG.Result calldata result,\\n uint256 seed,\\n uint256 startBlock\\n ) external view returns (bool isValid, string memory errorMsg) {\\n (bool hasValidFields, string memory error) = validateFields(result);\\n if (!hasValidFields) {\\n return (false, error);\\n }\\n\\n if (!validateSignatures(result, startBlock)) {\\n return (false, \\\"Invalid signatures\\\");\\n }\\n\\n if (!validateGroupMembers(result, seed)) {\\n return (false, \\\"Invalid group members\\\");\\n }\\n\\n // At this point all group members and mishbehaved members were verified\\n if (!validateMembersHash(result)) {\\n return (false, \\\"Invalid members hash\\\");\\n }\\n\\n return (true, \\\"\\\");\\n }\\n\\n /// @notice Performs a static validation of DKG result fields: lengths,\\n /// ranges, and order of arrays.\\n /// @return isValid true if the result is valid, false otherwise\\n /// @return errorMsg validation error message; empty for a valid result\\n function validateFields(DKG.Result calldata result)\\n public\\n pure\\n returns (bool isValid, string memory errorMsg)\\n {\\n // Group public key needs to be 128 bytes long.\\n if (result.groupPubKey.length != 128) {\\n return (false, \\\"Malformed group public key\\\");\\n }\\n\\n // The number of misbehaved members can not exceed the threshold.\\n // Misbehaved member indices needs to be unique, between [1, groupSize],\\n // and sorted in ascending order.\\n uint8[] calldata misbehavedMembersIndices = result\\n .misbehavedMembersIndices;\\n if (groupSize - misbehavedMembersIndices.length < activeThreshold) {\\n return (false, \\\"Too many members misbehaving during DKG\\\");\\n }\\n if (misbehavedMembersIndices.length > 1) {\\n if (\\n misbehavedMembersIndices[0] < 1 ||\\n misbehavedMembersIndices[misbehavedMembersIndices.length - 1] >\\n groupSize\\n ) {\\n return (false, \\\"Corrupted misbehaved members indices\\\");\\n }\\n for (uint256 i = 1; i < misbehavedMembersIndices.length; i++) {\\n if (\\n misbehavedMembersIndices[i - 1] >=\\n misbehavedMembersIndices[i]\\n ) {\\n return (false, \\\"Corrupted misbehaved members indices\\\");\\n }\\n }\\n }\\n\\n // Each signature needs to have a correct length and signatures need to\\n // be provided.\\n uint256 signaturesCount = result.signatures.length / signatureByteSize;\\n if (result.signatures.length == 0) {\\n return (false, \\\"No signatures provided\\\");\\n }\\n if (result.signatures.length % signatureByteSize != 0) {\\n return (false, \\\"Malformed signatures array\\\");\\n }\\n\\n // We expect the same amount of signatures as the number of declared\\n // group member indices that signed the result.\\n uint256[] calldata signingMembersIndices = result.signingMembersIndices;\\n if (signaturesCount != signingMembersIndices.length) {\\n return (false, \\\"Unexpected signatures count\\\");\\n }\\n if (signaturesCount < groupThreshold) {\\n return (false, \\\"Too few signatures\\\");\\n }\\n if (signaturesCount > groupSize) {\\n return (false, \\\"Too many signatures\\\");\\n }\\n\\n // Signing member indices needs to be unique, between [1,groupSize],\\n // and sorted in ascending order.\\n if (\\n signingMembersIndices[0] < 1 ||\\n signingMembersIndices[signingMembersIndices.length - 1] > groupSize\\n ) {\\n return (false, \\\"Corrupted signing member indices\\\");\\n }\\n for (uint256 i = 1; i < signingMembersIndices.length; i++) {\\n if (signingMembersIndices[i - 1] >= signingMembersIndices[i]) {\\n return (false, \\\"Corrupted signing member indices\\\");\\n }\\n }\\n\\n return (true, \\\"\\\");\\n }\\n\\n /// @notice Performs validation of group members as declared in DKG\\n /// result against group members selected by the sortition pool.\\n /// @param seed seed used to start the DKG and select group members\\n /// @return true if group members matches; false otherwise\\n function validateGroupMembers(DKG.Result calldata result, uint256 seed)\\n public\\n view\\n returns (bool)\\n {\\n uint32[] calldata resultMembers = result.members;\\n uint32[] memory actualGroupMembers = sortitionPool.selectGroup(\\n groupSize,\\n bytes32(seed)\\n );\\n if (resultMembers.length != actualGroupMembers.length) {\\n return false;\\n }\\n for (uint256 i = 0; i < resultMembers.length; i++) {\\n if (resultMembers[i] != actualGroupMembers[i]) {\\n return false;\\n }\\n }\\n return true;\\n }\\n\\n /// @notice Performs validation of signatures supplied in DKG result.\\n /// Note that this function does not check if addresses which\\n /// supplied signatures supporting the result are the ones selected\\n /// to the group by sortition pool. This function should be used\\n /// together with `validateGroupMembers`.\\n /// @param startBlock DKG start block\\n /// @return true if group members matches; false otherwise\\n function validateSignatures(DKG.Result calldata result, uint256 startBlock)\\n public\\n view\\n returns (bool)\\n {\\n bytes32 hash = keccak256(\\n abi.encode(\\n block.chainid,\\n result.groupPubKey,\\n result.misbehavedMembersIndices,\\n startBlock\\n )\\n ).toEthSignedMessageHash();\\n\\n uint256[] calldata signingMembersIndices = result.signingMembersIndices;\\n uint32[] memory signingMemberIds = new uint32[](\\n signingMembersIndices.length\\n );\\n for (uint256 i = 0; i < signingMembersIndices.length; i++) {\\n signingMemberIds[i] = result.members[signingMembersIndices[i] - 1];\\n }\\n\\n address[] memory signingMemberAddresses = sortitionPool.getIDOperators(\\n signingMemberIds\\n );\\n\\n bytes memory current; // Current signature to be checked.\\n\\n uint256 signaturesCount = result.signatures.length / signatureByteSize;\\n for (uint256 i = 0; i < signaturesCount; i++) {\\n current = result.signatures.slice(\\n signatureByteSize * i,\\n signatureByteSize\\n );\\n address recoveredAddress = hash.recover(current);\\n\\n if (signingMemberAddresses[i] != recoveredAddress) {\\n return false;\\n }\\n }\\n\\n return true;\\n }\\n\\n /// @notice Performs validation of hashed group members that actively took\\n /// part in DKG.\\n /// @param result DKG result\\n /// @return true if result's group members hash matches with the one that is\\n /// challenged.\\n function validateMembersHash(DKG.Result calldata result)\\n public\\n pure\\n returns (bool)\\n {\\n if (result.misbehavedMembersIndices.length > 0) {\\n // members that generated a group signing key\\n uint32[] memory groupMembers = new uint32[](\\n result.members.length - result.misbehavedMembersIndices.length\\n );\\n uint256 k = 0; // misbehaved members counter\\n uint256 j = 0; // group members counter\\n for (uint256 i = 0; i < result.members.length; i++) {\\n // misbehaved member indices start from 1, so we need to -1 on misbehaved\\n if (i != result.misbehavedMembersIndices[k] - 1) {\\n groupMembers[j] = result.members[i];\\n j++;\\n } else if (k < result.misbehavedMembersIndices.length - 1) {\\n k++;\\n }\\n }\\n\\n return keccak256(abi.encode(groupMembers)) == result.membersHash;\\n }\\n\\n return keccak256(abi.encode(result.members)) == result.membersHash;\\n }\\n}\\n\",\"keccak256\":\"0xaacb5961dc3181238036f1e747b3d1935f356ca5ff27bd9c9c1c0c22dee6630c\",\"license\":\"GPL-3.0-only\"},\"contracts/libraries/BeaconDkg.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\n//\\n// \\u2593\\u2593\\u258c \\u2593\\u2593 \\u2590\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u258c\\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2584\\n// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u258c\\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\n// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2580 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u258c \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\n// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2584\\u2584\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2580 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2584\\u2584\\u2584\\u2584 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2584\\u2584\\u2584\\u2584 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u258c \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\n// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2580 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\n// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2580\\u2580\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2584 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2580\\u2580\\u2580\\u2580 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2580\\u2580\\u2580\\u2580 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2580\\n// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2580\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2584 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u258c\\n// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2588\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\n// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\n//\\n//\\n\\npragma solidity 0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\nimport \\\"@keep-network/sortition-pools/contracts/SortitionPool.sol\\\";\\nimport \\\"./BytesLib.sol\\\";\\nimport {BeaconDkgValidator as DKGValidator} from \\\"../BeaconDkgValidator.sol\\\";\\n\\nlibrary BeaconDkg {\\n using BytesLib for bytes;\\n using ECDSA for bytes32;\\n\\n struct Parameters {\\n // Time in blocks during which a submitted result can be challenged.\\n uint256 resultChallengePeriodLength;\\n // Extra gas required to be left at the end of the challenge DKG result\\n // transaction.\\n uint256 resultChallengeExtraGas;\\n // Time in blocks during which a result is expected to be submitted.\\n uint256 resultSubmissionTimeout;\\n // Time in blocks during which only the result submitter is allowed to\\n // approve it. Once this period ends and the submitter have not approved\\n // the result, anyone can do it.\\n uint256 submitterPrecedencePeriodLength;\\n }\\n\\n struct Data {\\n // Address of the Sortition Pool contract.\\n SortitionPool sortitionPool;\\n // Address of the DKGValidator contract.\\n DKGValidator dkgValidator;\\n // DKG parameters. The parameters should persist between DKG executions.\\n // They should be updated with dedicated set functions only when DKG is not\\n // in progress.\\n Parameters parameters;\\n // Time in blocks at which DKG started.\\n uint256 startBlock;\\n // Seed used to start DKG.\\n uint256 seed;\\n // Time in blocks that should be added to result submission period calculation.\\n // It is used in case of a challenge to adjust DKG timeout calculation.\\n uint256 resultSubmissionStartBlockOffset;\\n // Hash of submitted DKG result.\\n bytes32 submittedResultHash;\\n // Block number from the moment of the DKG result submission.\\n uint256 submittedResultBlock;\\n }\\n\\n /// @notice DKG result.\\n struct Result {\\n // Claimed submitter candidate group member index.\\n // Must be in range [1, groupSize].\\n uint256 submitterMemberIndex;\\n // Generated candidate group public key\\n bytes groupPubKey;\\n // Array of misbehaved members indices (disqualified or inactive).\\n // Indices must be in range [1, groupSize], unique, and sorted in ascending\\n // order.\\n uint8[] misbehavedMembersIndices;\\n // Concatenation of signatures from members supporting the result.\\n // The message to be signed by each member is keccak256 hash of the\\n // calculated group public key, misbehaved members indices and DKG\\n // start block. The calculated hash should be prefixed with prefixed with\\n // `\\\\x19Ethereum signed message:\\\\n` before signing, so the message to\\n // sign is:\\n // `\\\\x19Ethereum signed message:\\\\n${keccak256(\\n // groupPubKey, misbehavedMembersIndices, dkgStartBlock\\n // )}`\\n bytes signatures;\\n // Indices of members corresponding to each signature. Indices must be\\n // be in range [1, groupSize], unique, and sorted in ascending order.\\n uint256[] signingMembersIndices;\\n // Identifiers of candidate group members as outputted by the group\\n // selection protocol.\\n uint32[] members;\\n // Keccak256 hash of group members identifiers that actively took part\\n // in DKG (excluding IA/DQ members).\\n bytes32 membersHash;\\n }\\n\\n /// @notice States for phases of group creation. The states doesn't include\\n /// timeouts which should be tracked and notified individually.\\n enum State {\\n // Group creation is not in progress. It is a state set after group creation\\n // completion either by timeout or by a result approval.\\n IDLE,\\n // Group creation is awaiting the seed and sortition pool is locked.\\n AWAITING_SEED,\\n // Off-chain DKG protocol execution is in progress. A result is being calculated\\n // by the clients in this state. It's not yet possible to submit the result.\\n KEY_GENERATION,\\n // After off-chain DKG protocol execution the contract awaits result submission.\\n // This is a state to which group creation returns in case of a result\\n // challenge notification.\\n AWAITING_RESULT,\\n // DKG result was submitted and awaits an approval or a challenge. If a result\\n // gets challenge the state returns to `AWAITING_RESULT`. If a result gets\\n // approval the state changes to `IDLE`.\\n CHALLENGE\\n }\\n\\n /// @dev Size of a group in the threshold relay.\\n uint256 public constant groupSize = 64;\\n\\n /// @notice Time in blocks after which DKG result is complete and ready to be\\n // published by clients.\\n uint256 public constant offchainDkgTime = 5 * (1 + 5) + 2 * (1 + 10) + 20;\\n\\n event DkgStarted(uint256 indexed seed);\\n\\n // To recreate the members that actively took part in dkg, the selected members\\n // array should be filtered out from misbehavedMembersIndices.\\n event DkgResultSubmitted(\\n bytes32 indexed resultHash,\\n uint256 indexed seed,\\n Result result\\n );\\n\\n event DkgTimedOut();\\n\\n event DkgResultApproved(\\n bytes32 indexed resultHash,\\n address indexed approver\\n );\\n\\n event DkgResultChallenged(\\n bytes32 indexed resultHash,\\n address indexed challenger,\\n string reason\\n );\\n\\n event DkgStateLocked();\\n\\n event DkgSeedTimedOut();\\n\\n /// @notice Initializes SortitionPool and DKGValidator addresses.\\n /// Can be performed only once.\\n /// @param _sortitionPool Sortition Pool reference\\n /// @param _dkgValidator DKGValidator reference\\n function init(\\n Data storage self,\\n SortitionPool _sortitionPool,\\n DKGValidator _dkgValidator\\n ) internal {\\n require(\\n address(self.sortitionPool) == address(0),\\n \\\"Sortition Pool address already set\\\"\\n );\\n\\n require(\\n address(self.dkgValidator) == address(0),\\n \\\"DKG Validator address already set\\\"\\n );\\n\\n self.sortitionPool = _sortitionPool;\\n self.dkgValidator = _dkgValidator;\\n }\\n\\n /// @notice Determines the current state of group creation. It doesn't take\\n /// timeouts into consideration. The timeouts should be tracked and\\n /// notified separately.\\n function currentState(Data storage self)\\n internal\\n view\\n returns (State state)\\n {\\n state = State.IDLE;\\n\\n if (self.sortitionPool.isLocked()) {\\n state = State.AWAITING_SEED;\\n\\n if (self.startBlock > 0) {\\n state = State.KEY_GENERATION;\\n\\n if (block.number > self.startBlock + offchainDkgTime) {\\n state = State.AWAITING_RESULT;\\n\\n if (self.submittedResultBlock > 0) {\\n state = State.CHALLENGE;\\n }\\n }\\n }\\n }\\n }\\n\\n /// @notice Locks the sortition pool and starts awaiting for the\\n /// group creation seed.\\n function lockState(Data storage self) internal {\\n require(currentState(self) == State.IDLE, \\\"Current state is not IDLE\\\");\\n\\n emit DkgStateLocked();\\n\\n self.sortitionPool.lock();\\n }\\n\\n function start(Data storage self, uint256 seed) internal {\\n require(\\n currentState(self) == State.AWAITING_SEED,\\n \\\"Current state is not AWAITING_SEED\\\"\\n );\\n\\n emit DkgStarted(seed);\\n\\n self.startBlock = block.number;\\n self.seed = seed;\\n }\\n\\n /// @notice Allows to submit a DKG result. The submitted result does not go\\n /// through a validation and before it gets accepted, it needs to\\n /// wait through the challenge period during which everyone has\\n /// a chance to challenge the result as invalid one. Submitter of\\n /// the result needs to be in the sortition pool and if the result\\n /// gets challenged, the submitter will get slashed.\\n function submitResult(Data storage self, Result calldata result) external {\\n require(\\n currentState(self) == State.AWAITING_RESULT,\\n \\\"Current state is not AWAITING_RESULT\\\"\\n );\\n require(!hasDkgTimedOut(self), \\\"DKG timeout already passed\\\");\\n\\n SortitionPool sortitionPool = self.sortitionPool;\\n\\n // Submitter must be an operator in the sortition pool.\\n // Declared submitter's member index in the DKG result needs to match\\n // the address calling this function.\\n require(\\n sortitionPool.isOperatorInPool(msg.sender),\\n \\\"Submitter not in the sortition pool\\\"\\n );\\n require(\\n sortitionPool.getIDOperator(\\n result.members[result.submitterMemberIndex - 1]\\n ) == msg.sender,\\n \\\"Unexpected submitter index\\\"\\n );\\n\\n self.submittedResultHash = keccak256(abi.encode(result));\\n self.submittedResultBlock = block.number;\\n\\n emit DkgResultSubmitted(self.submittedResultHash, self.seed, result);\\n }\\n\\n /// @notice Checks if DKG timed out. The DKG timeout period includes time required\\n /// for off-chain protocol execution and time for the result publication.\\n /// After this time a result cannot be submitted and DKG can be notified\\n /// about the timeout. DKG period is adjusted by result submission\\n /// offset that include blocks that were mined while invalid result\\n /// has been registered until it got challenged.\\n /// @return True if DKG timed out, false otherwise.\\n function hasDkgTimedOut(Data storage self) internal view returns (bool) {\\n return\\n currentState(self) == State.AWAITING_RESULT &&\\n block.number >\\n (self.startBlock +\\n offchainDkgTime +\\n self.resultSubmissionStartBlockOffset +\\n self.parameters.resultSubmissionTimeout);\\n }\\n\\n /// @notice Notifies about DKG timeout.\\n function notifyTimeout(Data storage self) internal {\\n require(hasDkgTimedOut(self), \\\"DKG has not timed out\\\");\\n\\n emit DkgTimedOut();\\n\\n complete(self);\\n }\\n\\n /// @notice Notifies about the seed was not delivered and restores the\\n /// initial DKG state (IDLE).\\n function notifySeedTimedOut(Data storage self) internal {\\n require(\\n currentState(self) == State.AWAITING_SEED,\\n \\\"Current state is not AWAITING_SEED\\\"\\n );\\n\\n emit DkgSeedTimedOut();\\n\\n complete(self);\\n }\\n\\n /// @notice Approves DKG result. Can be called when the challenge period for\\n /// the submitted result is finished. Considers the submitted result\\n /// as valid. For the first `submitterPrecedencePeriodLength`\\n /// blocks after the end of the challenge period can be called only\\n /// by the DKG result submitter. After that time, can be called by\\n /// anyone.\\n /// @dev Can be called after a challenge period for the submitted result.\\n /// @param result Result to approve. Must match the submitted result stored\\n /// during `submitResult`.\\n /// @return misbehavedMembers Identifiers of members who misbehaved during DKG.\\n function approveResult(Data storage self, Result calldata result)\\n external\\n returns (uint32[] memory misbehavedMembers)\\n {\\n require(\\n currentState(self) == State.CHALLENGE,\\n \\\"Current state is not CHALLENGE\\\"\\n );\\n\\n uint256 challengePeriodEnd = self.submittedResultBlock +\\n self.parameters.resultChallengePeriodLength;\\n\\n require(\\n block.number > challengePeriodEnd,\\n \\\"Challenge period has not passed yet\\\"\\n );\\n\\n require(\\n keccak256(abi.encode(result)) == self.submittedResultHash,\\n \\\"Result under approval is different than the submitted one\\\"\\n );\\n\\n // Extract submitter member address. Submitter member index is in\\n // range [1, groupSize] so we need to -1 when fetching identifier from members\\n // array.\\n address submitterMember = self.sortitionPool.getIDOperator(\\n result.members[result.submitterMemberIndex - 1]\\n );\\n\\n require(\\n msg.sender == submitterMember ||\\n block.number >\\n challengePeriodEnd +\\n self.parameters.submitterPrecedencePeriodLength,\\n \\\"Only the DKG result submitter can approve the result at this moment\\\"\\n );\\n\\n // Extract misbehaved members identifiers. Misbehaved members indices\\n // are in range [1, groupSize], so we need to -1 when fetching identifiers from\\n // members array.\\n misbehavedMembers = new uint32[](\\n result.misbehavedMembersIndices.length\\n );\\n for (uint256 i = 0; i < result.misbehavedMembersIndices.length; i++) {\\n misbehavedMembers[i] = result.members[\\n result.misbehavedMembersIndices[i] - 1\\n ];\\n }\\n\\n emit DkgResultApproved(self.submittedResultHash, msg.sender);\\n\\n return misbehavedMembers;\\n }\\n\\n /// @notice Challenges DKG result. If the submitted result is proved to be\\n /// invalid it reverts the DKG back to the result submission phase.\\n /// @dev Can be called during a challenge period for the submitted result.\\n /// @param result Result to challenge. Must match the submitted result\\n /// stored during `submitResult`.\\n /// @return maliciousResultHash Hash of the malicious result.\\n /// @return maliciousSubmitter Identifier of the malicious submitter.\\n function challengeResult(Data storage self, Result calldata result)\\n external\\n returns (bytes32 maliciousResultHash, uint32 maliciousSubmitter)\\n {\\n require(\\n currentState(self) == State.CHALLENGE,\\n \\\"Current state is not CHALLENGE\\\"\\n );\\n\\n require(\\n block.number <=\\n self.submittedResultBlock +\\n self.parameters.resultChallengePeriodLength,\\n \\\"Challenge period has already passed\\\"\\n );\\n\\n require(\\n keccak256(abi.encode(result)) == self.submittedResultHash,\\n \\\"Result under challenge is different than the submitted one\\\"\\n );\\n\\n // https://github.com/crytic/slither/issues/982\\n // slither-disable-next-line unused-return\\n try\\n self.dkgValidator.validate(result, self.seed, self.startBlock)\\n returns (\\n // slither-disable-next-line uninitialized-local,variable-scope\\n bool isValid,\\n // slither-disable-next-line uninitialized-local,variable-scope\\n string memory errorMsg\\n ) {\\n if (isValid) {\\n revert(\\\"unjustified challenge\\\");\\n }\\n\\n emit DkgResultChallenged(\\n self.submittedResultHash,\\n msg.sender,\\n errorMsg\\n );\\n } catch {\\n // if the validation reverted we consider the DKG result as invalid\\n emit DkgResultChallenged(\\n self.submittedResultHash,\\n msg.sender,\\n \\\"validation reverted\\\"\\n );\\n }\\n\\n // Consider result hash as malicious.\\n maliciousResultHash = self.submittedResultHash;\\n maliciousSubmitter = result.members[result.submitterMemberIndex - 1];\\n\\n // Adjust DKG result submission block start, so submission stage starts\\n // from the beginning.\\n self.resultSubmissionStartBlockOffset =\\n block.number -\\n self.startBlock -\\n offchainDkgTime;\\n\\n submittedResultCleanup(self);\\n\\n return (maliciousResultHash, maliciousSubmitter);\\n }\\n\\n /// @notice Due to EIP150, 1/64 of the gas is not forwarded to the call, and\\n /// will be kept to execute the remaining operations in the function\\n /// after the call inside the try-catch.\\n ///\\n /// To ensure there is no way for the caller to manipulate gas limit\\n /// in such a way that the call inside try-catch fails with out-of-gas\\n /// and the rest of the function is executed with the remaining\\n /// 1/64 of gas, we require an extra gas amount to be left at the\\n /// end of the call to the function challenging DKG result and\\n /// wrapping the call to BeaconDkgValidator and TokenStaking\\n /// contracts inside a try-catch.\\n function requireChallengeExtraGas(Data storage self) internal view {\\n require(\\n gasleft() >= self.parameters.resultChallengeExtraGas,\\n \\\"Not enough extra gas left\\\"\\n );\\n }\\n\\n /// @notice Updates DKG-related parameters\\n /// @param _resultChallengePeriodLength New value of the result challenge\\n /// period length. It is the number of blocks for which a DKG result\\n /// can be challenged.\\n /// @param _resultChallengeExtraGas New value of the result challenge extra\\n /// gas. It is the extra gas required to be left at the end of the\\n /// challenge DKG result transaction.\\n /// @param _resultSubmissionTimeout New value of the result submission\\n /// timeout in seconds. It is a timeout for a group to provide a DKG\\n /// result.\\n /// @param _submitterPrecedencePeriodLength New value of the submitter\\n /// precedence period length in blocks. It is the time during which\\n /// only the original DKG result submitter can approve it.\\n function setParameters(\\n Data storage self,\\n uint256 _resultChallengePeriodLength,\\n uint256 _resultChallengeExtraGas,\\n uint256 _resultSubmissionTimeout,\\n uint256 _submitterPrecedencePeriodLength\\n ) internal {\\n require(currentState(self) == State.IDLE, \\\"Current state is not IDLE\\\");\\n\\n require(\\n _resultChallengePeriodLength > 0,\\n \\\"Result challenge period length should be greater than zero\\\"\\n );\\n require(\\n _resultSubmissionTimeout > 0,\\n \\\"Result submission timeout should be greater than zero\\\"\\n );\\n require(\\n _submitterPrecedencePeriodLength < _resultSubmissionTimeout,\\n \\\"Submitter precedence period length should be less than the result submission timeout\\\"\\n );\\n\\n self\\n .parameters\\n .resultChallengePeriodLength = _resultChallengePeriodLength;\\n self.parameters.resultChallengeExtraGas = _resultChallengeExtraGas;\\n self.parameters.resultSubmissionTimeout = _resultSubmissionTimeout;\\n self\\n .parameters\\n .submitterPrecedencePeriodLength = _submitterPrecedencePeriodLength;\\n }\\n\\n /// @notice Completes DKG by cleaning up state.\\n /// @dev Should be called after DKG times out or a result is approved.\\n function complete(Data storage self) internal {\\n delete self.startBlock;\\n delete self.seed;\\n delete self.resultSubmissionStartBlockOffset;\\n submittedResultCleanup(self);\\n self.sortitionPool.unlock();\\n }\\n\\n /// @notice Cleans up submitted result state either after DKG completion\\n /// (as part of `complete` method) or after justified challenge.\\n function submittedResultCleanup(Data storage self) private {\\n delete self.submittedResultHash;\\n delete self.submittedResultBlock;\\n }\\n}\\n\",\"keccak256\":\"0x86bea35ab775ec969bc91208305f6f85aa9dd49bb74f8e57e7d453797e8ad98e\",\"license\":\"GPL-3.0-only\"},\"contracts/libraries/BytesLib.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0-only\\n//\\n// \\u2593\\u2593\\u258c \\u2593\\u2593 \\u2590\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u258c\\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2584\\n// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u258c\\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\n// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2580 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u258c \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\n// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2584\\u2584\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2580 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2584\\u2584\\u2584\\u2584 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2584\\u2584\\u2584\\u2584 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u258c \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\n// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2580 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\n// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2580\\u2580\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2584 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2580\\u2580\\u2580\\u2580 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2580\\u2580\\u2580\\u2580 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2580\\n// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2580\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2584 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u258c\\n// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2588\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\n// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2590\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\n//\\n//\\n\\npragma solidity 0.8.17;\\n\\n/*\\nVersion pulled from keep-core v1:\\nhttps://github.com/keep-network/keep-core/blob/f297202db00c027978ad8e7103a356503de5773c/solidity-v1/contracts/utils/BytesLib.sol\\n\\nTo compile it with solidity 0.8 `_preBytes_slot` was replaced with `_preBytes.slot`.\\n*/\\n\\n/*\\nhttps://github.com/GNSPS/solidity-bytes-utils/\\nThis is free and unencumbered software released into the public domain.\\nAnyone is free to copy, modify, publish, use, compile, sell, or\\ndistribute this software, either in source code form or as a compiled\\nbinary, for any purpose, commercial or non-commercial, and by any\\nmeans.\\nIn jurisdictions that recognize copyright laws, the author or authors\\nof this software dedicate any and all copyright interest in the\\nsoftware to the public domain. We make this dedication for the benefit\\nof the public at large and to the detriment of our heirs and\\nsuccessors. We intend this dedication to be an overt act of\\nrelinquishment in perpetuity of all present and future rights to this\\nsoftware under copyright law.\\nTHE SOFTWARE IS PROVIDED \\\"AS IS\\\", WITHOUT WARRANTY OF ANY KIND,\\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\\nIN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR\\nOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\\nARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\\nOTHER DEALINGS IN THE SOFTWARE.\\nFor more information, please refer to <https://unlicense.org>\\n*/\\n\\n/** @title BytesLib **/\\n/** @author https://github.com/GNSPS **/\\n\\nlibrary BytesLib {\\n function concatStorage(bytes storage _preBytes, bytes memory _postBytes)\\n internal\\n {\\n assembly {\\n // Read the first 32 bytes of _preBytes storage, which is the length\\n // of the array. (We don't need to use the offset into the slot\\n // because arrays use the entire slot.)\\n let fslot := sload(_preBytes.slot)\\n // Arrays of 31 bytes or less have an even value in their slot,\\n // while longer arrays have an odd value. The actual length is\\n // the slot divided by two for odd values, and the lowest order\\n // byte divided by two for even values.\\n // If the slot is even, bitwise and the slot with 255 and divide by\\n // two to get the length. If the slot is odd, bitwise and the slot\\n // with -1 and divide by two.\\n let slength := div(\\n and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)),\\n 2\\n )\\n let mlength := mload(_postBytes)\\n let newlength := add(slength, mlength)\\n // slength can contain both the length and contents of the array\\n // if length < 32 bytes so let's prepare for that\\n // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage\\n switch add(lt(slength, 32), lt(newlength, 32))\\n case 2 {\\n // Since the new array still fits in the slot, we just need to\\n // update the contents of the slot.\\n // uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length\\n sstore(\\n _preBytes.slot,\\n // all the modifications to the slot are inside this\\n // next block\\n add(\\n // we can just add to the slot contents because the\\n // bytes we want to change are the LSBs\\n fslot,\\n add(\\n mul(\\n div(\\n // load the bytes from memory\\n mload(add(_postBytes, 0x20)),\\n // zero all bytes to the right\\n exp(0x100, sub(32, mlength))\\n ),\\n // and now shift left the number of bytes to\\n // leave space for the length in the slot\\n exp(0x100, sub(32, newlength))\\n ),\\n // increase length by the double of the memory\\n // bytes length\\n mul(mlength, 2)\\n )\\n )\\n )\\n }\\n case 1 {\\n // The stored value fits in the slot, but the combined value\\n // will exceed it.\\n // get the keccak hash to get the contents of the array\\n mstore(0x0, _preBytes.slot)\\n let sc := add(keccak256(0x0, 0x20), div(slength, 32))\\n\\n // save new length\\n sstore(_preBytes.slot, add(mul(newlength, 2), 1))\\n\\n // The contents of the _postBytes array start 32 bytes into\\n // the structure. Our first read should obtain the `submod`\\n // bytes that can fit into the unused space in the last word\\n // of the stored array. To get this, we read 32 bytes starting\\n // from `submod`, so the data we read overlaps with the array\\n // contents by `submod` bytes. Masking the lowest-order\\n // `submod` bytes allows us to add that value directly to the\\n // stored value.\\n\\n let submod := sub(32, slength)\\n let mc := add(_postBytes, submod)\\n let end := add(_postBytes, mlength)\\n let mask := sub(exp(0x100, submod), 1)\\n\\n sstore(\\n sc,\\n add(\\n and(\\n fslot,\\n 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00\\n ),\\n and(mload(mc), mask)\\n )\\n )\\n\\n for {\\n mc := add(mc, 0x20)\\n sc := add(sc, 1)\\n } lt(mc, end) {\\n sc := add(sc, 1)\\n mc := add(mc, 0x20)\\n } {\\n sstore(sc, mload(mc))\\n }\\n\\n mask := exp(0x100, sub(mc, end))\\n\\n sstore(sc, mul(div(mload(mc), mask), mask))\\n }\\n default {\\n // get the keccak hash to get the contents of the array\\n mstore(0x0, _preBytes.slot)\\n // Start copying to the last used word of the stored array.\\n let sc := add(keccak256(0x0, 0x20), div(slength, 32))\\n\\n // save new length\\n sstore(_preBytes.slot, add(mul(newlength, 2), 1))\\n\\n // Copy over the first `submod` bytes of the new data as in\\n // case 1 above.\\n let slengthmod := mod(slength, 32)\\n let submod := sub(32, slengthmod)\\n let mc := add(_postBytes, submod)\\n let end := add(_postBytes, mlength)\\n let mask := sub(exp(0x100, submod), 1)\\n\\n sstore(sc, add(sload(sc), and(mload(mc), mask)))\\n\\n for {\\n sc := add(sc, 1)\\n mc := add(mc, 0x20)\\n } lt(mc, end) {\\n sc := add(sc, 1)\\n mc := add(mc, 0x20)\\n } {\\n sstore(sc, mload(mc))\\n }\\n\\n mask := exp(0x100, sub(mc, end))\\n\\n sstore(sc, mul(div(mload(mc), mask), mask))\\n }\\n }\\n }\\n\\n function equalStorage(bytes storage _preBytes, bytes memory _postBytes)\\n internal\\n view\\n returns (bool)\\n {\\n bool success = true;\\n\\n assembly {\\n // we know _preBytes_offset is 0\\n let fslot := sload(_preBytes.slot)\\n // Decode the length of the stored array like in concatStorage().\\n let slength := div(\\n and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)),\\n 2\\n )\\n let mlength := mload(_postBytes)\\n\\n // if lengths don't match the arrays are not equal\\n switch eq(slength, mlength)\\n case 1 {\\n // slength can contain both the length and contents of the array\\n // if length < 32 bytes so let's prepare for that\\n // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage\\n if iszero(iszero(slength)) {\\n switch lt(slength, 32)\\n case 1 {\\n // blank the last byte which is the length\\n fslot := mul(div(fslot, 0x100), 0x100)\\n\\n if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) {\\n // unsuccess:\\n success := 0\\n }\\n }\\n default {\\n // cb is a circuit breaker in the for loop since there's\\n // no said feature for inline assembly loops\\n // cb = 1 - don't breaker\\n // cb = 0 - break\\n let cb := 1\\n\\n // get the keccak hash to get the contents of the array\\n mstore(0x0, _preBytes.slot)\\n let sc := keccak256(0x0, 0x20)\\n\\n let mc := add(_postBytes, 0x20)\\n let end := add(mc, mlength)\\n\\n // the next line is the loop condition:\\n // while(uint(mc < end) + cb == 2)\\n for {\\n\\n } eq(add(lt(mc, end), cb), 2) {\\n sc := add(sc, 1)\\n mc := add(mc, 0x20)\\n } {\\n if iszero(eq(sload(sc), mload(mc))) {\\n // unsuccess:\\n success := 0\\n cb := 0\\n }\\n }\\n }\\n }\\n }\\n default {\\n // unsuccess:\\n success := 0\\n }\\n }\\n\\n return success;\\n }\\n\\n function concat(bytes memory _preBytes, bytes memory _postBytes)\\n internal\\n pure\\n returns (bytes memory)\\n {\\n bytes memory tempBytes;\\n\\n assembly {\\n // Get a location of some free memory and store it in tempBytes as\\n // Solidity does for memory variables.\\n tempBytes := mload(0x40)\\n\\n // Store the length of the first bytes array at the beginning of\\n // the memory for tempBytes.\\n let length := mload(_preBytes)\\n mstore(tempBytes, length)\\n\\n // Maintain a memory counter for the current write location in the\\n // temp bytes array by adding the 32 bytes for the array length to\\n // the starting location.\\n let mc := add(tempBytes, 0x20)\\n // Stop copying when the memory counter reaches the length of the\\n // first bytes array.\\n let end := add(mc, length)\\n\\n for {\\n // Initialize a copy counter to the start of the _preBytes data,\\n // 32 bytes into its memory.\\n let cc := add(_preBytes, 0x20)\\n } lt(mc, end) {\\n // Increase both counters by 32 bytes each iteration.\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n // Write the _preBytes data into the tempBytes memory 32 bytes\\n // at a time.\\n mstore(mc, mload(cc))\\n }\\n\\n // Add the length of _postBytes to the current length of tempBytes\\n // and store it as the new length in the first 32 bytes of the\\n // tempBytes memory.\\n length := mload(_postBytes)\\n mstore(tempBytes, add(length, mload(tempBytes)))\\n\\n // Move the memory counter back from a multiple of 0x20 to the\\n // actual end of the _preBytes data.\\n mc := end\\n // Stop copying when the memory counter reaches the new combined\\n // length of the arrays.\\n end := add(mc, length)\\n\\n for {\\n let cc := add(_postBytes, 0x20)\\n } lt(mc, end) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n mstore(mc, mload(cc))\\n }\\n\\n // Update the free-memory pointer by padding our last write location\\n // to 32 bytes: add 31 bytes to the end of tempBytes to move to the\\n // next 32 byte block, then round down to the nearest multiple of\\n // 32. If the sum of the length of the two arrays is zero then add\\n // one before rounding down to leave a blank 32 bytes (the length block with 0).\\n mstore(\\n 0x40,\\n and(\\n add(add(end, iszero(add(length, mload(_preBytes)))), 31),\\n not(31) // Round down to the nearest 32 bytes.\\n )\\n )\\n }\\n\\n return tempBytes;\\n }\\n\\n function slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n ) internal pure returns (bytes memory res) {\\n uint256 _end = _start + _length;\\n require(_end > _start && _bytes.length >= _end, \\\"Slice out of bounds\\\");\\n\\n assembly {\\n // Alloc bytes array with additional 32 bytes afterspace and assign it's size\\n res := mload(0x40)\\n mstore(0x40, add(add(res, 64), _length))\\n mstore(res, _length)\\n\\n // Compute distance between source and destination pointers\\n let diff := sub(res, add(_bytes, _start))\\n\\n for {\\n let src := add(add(_bytes, 32), _start)\\n let end := add(src, _length)\\n } lt(src, end) {\\n src := add(src, 32)\\n } {\\n mstore(add(src, diff), mload(src))\\n }\\n }\\n }\\n\\n function toAddress(bytes memory _bytes, uint256 _start)\\n internal\\n pure\\n returns (address)\\n {\\n uint256 _totalLen = _start + 20;\\n require(\\n _totalLen > _start && _bytes.length >= _totalLen,\\n \\\"Address conversion out of bounds.\\\"\\n );\\n address tempAddress;\\n\\n assembly {\\n tempAddress := div(\\n mload(add(add(_bytes, 0x20), _start)),\\n 0x1000000000000000000000000\\n )\\n }\\n\\n return tempAddress;\\n }\\n\\n function toUint8(bytes memory _bytes, uint256 _start)\\n internal\\n pure\\n returns (uint8)\\n {\\n require(\\n _bytes.length >= (_start + 1),\\n \\\"Uint8 conversion out of bounds.\\\"\\n );\\n uint8 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x1), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function toUint(bytes memory _bytes, uint256 _start)\\n internal\\n pure\\n returns (uint256)\\n {\\n uint256 _totalLen = _start + 32;\\n require(\\n _totalLen > _start && _bytes.length >= _totalLen,\\n \\\"Uint conversion out of bounds.\\\"\\n );\\n uint256 tempUint;\\n\\n assembly {\\n tempUint := mload(add(add(_bytes, 0x20), _start))\\n }\\n\\n return tempUint;\\n }\\n\\n function equal(bytes memory _preBytes, bytes memory _postBytes)\\n internal\\n pure\\n returns (bool)\\n {\\n bool success = true;\\n\\n assembly {\\n let length := mload(_preBytes)\\n\\n // if lengths don't match the arrays are not equal\\n switch eq(length, mload(_postBytes))\\n case 1 {\\n // cb is a circuit breaker in the for loop since there's\\n // no said feature for inline assembly loops\\n // cb = 1 - don't breaker\\n // cb = 0 - break\\n let cb := 1\\n\\n let mc := add(_preBytes, 0x20)\\n let end := add(mc, length)\\n\\n for {\\n let cc := add(_postBytes, 0x20)\\n // the next line is the loop condition:\\n // while(uint(mc < end) + cb == 2)\\n } eq(add(lt(mc, end), cb), 2) {\\n mc := add(mc, 0x20)\\n cc := add(cc, 0x20)\\n } {\\n // if any of these checks fails then arrays are not equal\\n if iszero(eq(mload(mc), mload(cc))) {\\n // unsuccess:\\n success := 0\\n cb := 0\\n }\\n }\\n }\\n default {\\n // unsuccess:\\n success := 0\\n }\\n }\\n\\n return success;\\n }\\n\\n function toBytes32(bytes memory _source)\\n internal\\n pure\\n returns (bytes32 result)\\n {\\n if (_source.length == 0) {\\n return 0x0;\\n }\\n\\n assembly {\\n result := mload(add(_source, 32))\\n }\\n }\\n\\n function keccak256Slice(\\n bytes memory _bytes,\\n uint256 _start,\\n uint256 _length\\n ) internal pure returns (bytes32 result) {\\n uint256 _end = _start + _length;\\n require(_end > _start && _bytes.length >= _end, \\\"Slice out of bounds\\\");\\n\\n assembly {\\n result := keccak256(add(add(_bytes, 32), _start), _length)\\n }\\n }\\n}\\n\",\"keccak256\":\"0x3b76e2fe36eb777440250dcf2ea7a689375e8af22f3cc33521095ff6954becdb\",\"license\":\"GPL-3.0-only\"}},\"version\":1}",
|
|
187
|
+
"bytecode": "0x6112ca61003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100615760003560e01c80630a1ba38e1461006657806346bf00db1461008157806363b635ea146100bb578063716ae957146100c3578063a29355e0146100f0575b600080fd5b61006e604881565b6040519081526020015b60405180910390f35b81801561008d57600080fd5b506100a161009c366004610cd5565b610112565b6040805192835263ffffffff909116602083015201610078565b61006e604081565b8180156100cf57600080fd5b506100e36100de366004610cd5565b61048c565b6040516100789190610d23565b8180156100fc57600080fd5b5061011061010b366004610cd5565b6108b5565b005b600080600461012085610bc5565b600481111561013157610131610d6d565b146101835760405162461bcd60e51b815260206004820152601e60248201527f43757272656e74207374617465206973206e6f74204348414c4c454e4745000060448201526064015b60405180910390fd5b6002840154600a8501546101979190610d99565b4311156101f25760405162461bcd60e51b815260206004820152602360248201527f4368616c6c656e676520706572696f642068617320616c7265616479207061736044820152621cd95960ea1b606482015260840161017a565b8360090154836040516020016102089190610ff9565b60405160208183030381529060405280519060200120146102915760405162461bcd60e51b815260206004820152603a60248201527f526573756c7420756e646572206368616c6c656e67652069732064696666657260448201527f656e74207468616e20746865207375626d6974746564206f6e65000000000000606482015260840161017a565b6001840154600785015460068601546040516373b33d5d60e11b81526001600160a01b039093169263e7667aba926102cd928892600401611013565b600060405180830381865afa92505050801561030b57506040513d6000823e601f3d908101601f191682016040526103089190810190611082565b60015b61038057336001600160a01b031684600901547f703feb01415a2995816e8d082fd7aad0eacada1a2f63fdb3226e47f8a0285436604051610373906020808252601390820152721d985b1a59185d1a5bdb881c995d995c9d1959606a1b604082015260600190565b60405180910390a361040f565b81156103c65760405162461bcd60e51b8152602060048201526015602482015274756e6a7573746966696564206368616c6c656e676560581b604482015260640161017a565b336001600160a01b031686600901547f703feb01415a2995816e8d082fd7aad0eacada1a2f63fdb3226e47f8a0285436836040516104049190611142565b60405180910390a350505b6009840154915061042360a0840184611175565b61042f600186356111bf565b81811061043e5761043e6111d2565b905060200201602081019061045391906111e8565b9050604884600601544361046791906111bf565b61047191906111bf565b6008850155600060098501819055600a8501555b9250929050565b6060600461049984610bc5565b60048111156104aa576104aa610d6d565b146104f75760405162461bcd60e51b815260206004820152601e60248201527f43757272656e74207374617465206973206e6f74204348414c4c454e47450000604482015260640161017a565b6002830154600a84015460009161050d91610d99565b905080431161056a5760405162461bcd60e51b815260206004820152602360248201527f4368616c6c656e676520706572696f6420686173206e6f7420706173736564206044820152621e595d60ea1b606482015260840161017a565b8360090154836040516020016105809190610ff9565b60405160208183030381529060405280519060200120146106095760405162461bcd60e51b815260206004820152603960248201527f526573756c7420756e64657220617070726f76616c206973206469666665726560448201527f6e74207468616e20746865207375626d6974746564206f6e6500000000000000606482015260840161017a565b83546000906001600160a01b0316638871ca5d61062960a0870187611175565b610635600189356111bf565b818110610644576106446111d2565b905060200201602081019061065991906111e8565b6040516001600160e01b031960e084901b16815263ffffffff919091166004820152602401602060405180830381865afa15801561069b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106bf9190611203565b9050336001600160a01b03821614806106e5575060058501546106e29083610d99565b43115b6107635760405162461bcd60e51b815260206004820152604360248201527f4f6e6c792074686520444b4720726573756c74207375626d697474657220636160448201527f6e20617070726f76652074686520726573756c742061742074686973206d6f6d606482015262195b9d60ea1b608482015260a40161017a565b6107706040850185611175565b905067ffffffffffffffff81111561078a5761078a611048565b6040519080825280602002602001820160405280156107b3578160200160208202803683370190505b50925060005b6107c66040860186611175565b905081101561087a576107dc60a0860186611175565b60016107eb6040890189611175565b858181106107fb576107fb6111d2565b9050602002016020810190610810919061122c565b61081a9190611247565b60ff1681811061082c5761082c6111d2565b905060200201602081019061084191906111e8565b848281518110610853576108536111d2565b63ffffffff909216602092830291909101909101528061087281611260565b9150506107b9565b5060098501546040513391907fe6e9d5eba171e82025efb3f3d44fd35905e7283d104284cb9f3bbc5bf1e4276f90600090a350505b92915050565b60036108c083610bc5565b60048111156108d1576108d1610d6d565b1461092a5760405162461bcd60e51b8152602060048201526024808201527f43757272656e74207374617465206973206e6f74204157414954494e475f524560448201526314d5531560e21b606482015260840161017a565b61093382610c78565b156109805760405162461bcd60e51b815260206004820152601a60248201527f444b472074696d656f757420616c726561647920706173736564000000000000604482015260640161017a565b81546040516307b8c36760e51b81523360048201526001600160a01b0390911690819063f7186ce090602401602060405180830381865afa1580156109c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ed9190611279565b610a455760405162461bcd60e51b815260206004820152602360248201527f5375626d6974746572206e6f7420696e2074686520736f72746974696f6e20706044820152621bdbdb60ea1b606482015260840161017a565b336001600160a01b038216638871ca5d610a6260a0860186611175565b610a6e600188356111bf565b818110610a7d57610a7d6111d2565b9050602002016020810190610a9291906111e8565b6040516001600160e01b031960e084901b16815263ffffffff919091166004820152602401602060405180830381865afa158015610ad4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610af89190611203565b6001600160a01b031614610b4e5760405162461bcd60e51b815260206004820152601a60248201527f556e6578706563746564207375626d697474657220696e646578000000000000604482015260640161017a565b81604051602001610b5f9190610ff9565b60408051601f198184030181529082905280516020909101206009850181905543600a8601556007850154917f8e7fd4293d7db11807147d8890c287fad3396fbb09a4e92273fc7856076c153a90610bb8908690610ff9565b60405180910390a3505050565b805460408051632938b58d60e21b815290516000926001600160a01b03169163a4e2d6349160048083019260209291908290030181865afa158015610c0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c329190611279565b15610c735750600681015460019015610c73576002905060488260060154610c5a9190610d99565b431115610c735750600a81015460039015610c73575060045b919050565b60006003610c8583610bc5565b6004811115610c9657610c96610d6d565b1480156108af5750600482015460088301546006840154610cb990604890610d99565b610cc39190610d99565b610ccd9190610d99565b431192915050565b60008060408385031215610ce857600080fd5b82359150602083013567ffffffffffffffff811115610d0657600080fd5b830160e08186031215610d1857600080fd5b809150509250929050565b6020808252825182820181905260009190848201906040850190845b81811015610d6157835163ffffffff1683529284019291840191600101610d3f565b50909695505050505050565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808201808211156108af576108af610d83565b6000808335601e19843603018112610dc357600080fd5b830160208101925035905067ffffffffffffffff811115610de357600080fd5b80360382131561048557600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6000808335601e19843603018112610e3257600080fd5b830160208101925035905067ffffffffffffffff811115610e5257600080fd5b8060051b360382131561048557600080fd5b803560ff81168114610c7357600080fd5b81835260006001600160fb1b03831115610e8e57600080fd5b8260051b80836020870137939093016020019392505050565b803563ffffffff81168114610c7357600080fd5b8183526000602080850194508260005b85811015610ef45763ffffffff610ee183610ea7565b1687529582019590820190600101610ecb565b509495945050505050565b8035825260006020610f1381840184610dac565b60e083870152610f2760e087018284610df2565b915050610f376040850185610e1b565b868303604088015280835290916000919084015b81831015610f735760ff610f5e85610e64565b16815292840192600192909201918401610f4b565b610f806060880188610dac565b955093508781036060890152610f97818686610df2565b945050505050610faa6080840184610e1b565b8583036080870152610fbd838284610e75565b92505050610fce60a0840184610e1b565b85830360a0870152610fe1838284610ebb565b9250505060c083013560c08501528091505092915050565b60208152600061100c6020830184610eff565b9392505050565b6060815260006110266060830186610eff565b60208301949094525060400152919050565b80518015158114610c7357600080fd5b634e487b7160e01b600052604160045260246000fd5b60005b83811015611079578181015183820152602001611061565b50506000910152565b6000806040838503121561109557600080fd5b61109e83611038565b9150602083015167ffffffffffffffff808211156110bb57600080fd5b818501915085601f8301126110cf57600080fd5b8151818111156110e1576110e1611048565b604051601f8201601f19908116603f0116810190838211818310171561110957611109611048565b8160405282815288602084870101111561112257600080fd5b61113383602083016020880161105e565b80955050505050509250929050565b602081526000825180602084015261116181604085016020870161105e565b601f01601f19169190910160400192915050565b6000808335601e1984360301811261118c57600080fd5b83018035915067ffffffffffffffff8211156111a757600080fd5b6020019150600581901b360382131561048557600080fd5b818103818111156108af576108af610d83565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156111fa57600080fd5b61100c82610ea7565b60006020828403121561121557600080fd5b81516001600160a01b038116811461100c57600080fd5b60006020828403121561123e57600080fd5b61100c82610e64565b60ff82811682821603908111156108af576108af610d83565b60006001820161127257611272610d83565b5060010190565b60006020828403121561128b57600080fd5b61100c8261103856fea26469706673582212200d5dae1b2939600e386623ef7defde718cd565d9d3a7e956d5adf754ff7891af64736f6c63430008110033",
|
|
188
|
+
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100615760003560e01c80630a1ba38e1461006657806346bf00db1461008157806363b635ea146100bb578063716ae957146100c3578063a29355e0146100f0575b600080fd5b61006e604881565b6040519081526020015b60405180910390f35b81801561008d57600080fd5b506100a161009c366004610cd5565b610112565b6040805192835263ffffffff909116602083015201610078565b61006e604081565b8180156100cf57600080fd5b506100e36100de366004610cd5565b61048c565b6040516100789190610d23565b8180156100fc57600080fd5b5061011061010b366004610cd5565b6108b5565b005b600080600461012085610bc5565b600481111561013157610131610d6d565b146101835760405162461bcd60e51b815260206004820152601e60248201527f43757272656e74207374617465206973206e6f74204348414c4c454e4745000060448201526064015b60405180910390fd5b6002840154600a8501546101979190610d99565b4311156101f25760405162461bcd60e51b815260206004820152602360248201527f4368616c6c656e676520706572696f642068617320616c7265616479207061736044820152621cd95960ea1b606482015260840161017a565b8360090154836040516020016102089190610ff9565b60405160208183030381529060405280519060200120146102915760405162461bcd60e51b815260206004820152603a60248201527f526573756c7420756e646572206368616c6c656e67652069732064696666657260448201527f656e74207468616e20746865207375626d6974746564206f6e65000000000000606482015260840161017a565b6001840154600785015460068601546040516373b33d5d60e11b81526001600160a01b039093169263e7667aba926102cd928892600401611013565b600060405180830381865afa92505050801561030b57506040513d6000823e601f3d908101601f191682016040526103089190810190611082565b60015b61038057336001600160a01b031684600901547f703feb01415a2995816e8d082fd7aad0eacada1a2f63fdb3226e47f8a0285436604051610373906020808252601390820152721d985b1a59185d1a5bdb881c995d995c9d1959606a1b604082015260600190565b60405180910390a361040f565b81156103c65760405162461bcd60e51b8152602060048201526015602482015274756e6a7573746966696564206368616c6c656e676560581b604482015260640161017a565b336001600160a01b031686600901547f703feb01415a2995816e8d082fd7aad0eacada1a2f63fdb3226e47f8a0285436836040516104049190611142565b60405180910390a350505b6009840154915061042360a0840184611175565b61042f600186356111bf565b81811061043e5761043e6111d2565b905060200201602081019061045391906111e8565b9050604884600601544361046791906111bf565b61047191906111bf565b6008850155600060098501819055600a8501555b9250929050565b6060600461049984610bc5565b60048111156104aa576104aa610d6d565b146104f75760405162461bcd60e51b815260206004820152601e60248201527f43757272656e74207374617465206973206e6f74204348414c4c454e47450000604482015260640161017a565b6002830154600a84015460009161050d91610d99565b905080431161056a5760405162461bcd60e51b815260206004820152602360248201527f4368616c6c656e676520706572696f6420686173206e6f7420706173736564206044820152621e595d60ea1b606482015260840161017a565b8360090154836040516020016105809190610ff9565b60405160208183030381529060405280519060200120146106095760405162461bcd60e51b815260206004820152603960248201527f526573756c7420756e64657220617070726f76616c206973206469666665726560448201527f6e74207468616e20746865207375626d6974746564206f6e6500000000000000606482015260840161017a565b83546000906001600160a01b0316638871ca5d61062960a0870187611175565b610635600189356111bf565b818110610644576106446111d2565b905060200201602081019061065991906111e8565b6040516001600160e01b031960e084901b16815263ffffffff919091166004820152602401602060405180830381865afa15801561069b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106bf9190611203565b9050336001600160a01b03821614806106e5575060058501546106e29083610d99565b43115b6107635760405162461bcd60e51b815260206004820152604360248201527f4f6e6c792074686520444b4720726573756c74207375626d697474657220636160448201527f6e20617070726f76652074686520726573756c742061742074686973206d6f6d606482015262195b9d60ea1b608482015260a40161017a565b6107706040850185611175565b905067ffffffffffffffff81111561078a5761078a611048565b6040519080825280602002602001820160405280156107b3578160200160208202803683370190505b50925060005b6107c66040860186611175565b905081101561087a576107dc60a0860186611175565b60016107eb6040890189611175565b858181106107fb576107fb6111d2565b9050602002016020810190610810919061122c565b61081a9190611247565b60ff1681811061082c5761082c6111d2565b905060200201602081019061084191906111e8565b848281518110610853576108536111d2565b63ffffffff909216602092830291909101909101528061087281611260565b9150506107b9565b5060098501546040513391907fe6e9d5eba171e82025efb3f3d44fd35905e7283d104284cb9f3bbc5bf1e4276f90600090a350505b92915050565b60036108c083610bc5565b60048111156108d1576108d1610d6d565b1461092a5760405162461bcd60e51b8152602060048201526024808201527f43757272656e74207374617465206973206e6f74204157414954494e475f524560448201526314d5531560e21b606482015260840161017a565b61093382610c78565b156109805760405162461bcd60e51b815260206004820152601a60248201527f444b472074696d656f757420616c726561647920706173736564000000000000604482015260640161017a565b81546040516307b8c36760e51b81523360048201526001600160a01b0390911690819063f7186ce090602401602060405180830381865afa1580156109c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ed9190611279565b610a455760405162461bcd60e51b815260206004820152602360248201527f5375626d6974746572206e6f7420696e2074686520736f72746974696f6e20706044820152621bdbdb60ea1b606482015260840161017a565b336001600160a01b038216638871ca5d610a6260a0860186611175565b610a6e600188356111bf565b818110610a7d57610a7d6111d2565b9050602002016020810190610a9291906111e8565b6040516001600160e01b031960e084901b16815263ffffffff919091166004820152602401602060405180830381865afa158015610ad4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610af89190611203565b6001600160a01b031614610b4e5760405162461bcd60e51b815260206004820152601a60248201527f556e6578706563746564207375626d697474657220696e646578000000000000604482015260640161017a565b81604051602001610b5f9190610ff9565b60408051601f198184030181529082905280516020909101206009850181905543600a8601556007850154917f8e7fd4293d7db11807147d8890c287fad3396fbb09a4e92273fc7856076c153a90610bb8908690610ff9565b60405180910390a3505050565b805460408051632938b58d60e21b815290516000926001600160a01b03169163a4e2d6349160048083019260209291908290030181865afa158015610c0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c329190611279565b15610c735750600681015460019015610c73576002905060488260060154610c5a9190610d99565b431115610c735750600a81015460039015610c73575060045b919050565b60006003610c8583610bc5565b6004811115610c9657610c96610d6d565b1480156108af5750600482015460088301546006840154610cb990604890610d99565b610cc39190610d99565b610ccd9190610d99565b431192915050565b60008060408385031215610ce857600080fd5b82359150602083013567ffffffffffffffff811115610d0657600080fd5b830160e08186031215610d1857600080fd5b809150509250929050565b6020808252825182820181905260009190848201906040850190845b81811015610d6157835163ffffffff1683529284019291840191600101610d3f565b50909695505050505050565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808201808211156108af576108af610d83565b6000808335601e19843603018112610dc357600080fd5b830160208101925035905067ffffffffffffffff811115610de357600080fd5b80360382131561048557600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6000808335601e19843603018112610e3257600080fd5b830160208101925035905067ffffffffffffffff811115610e5257600080fd5b8060051b360382131561048557600080fd5b803560ff81168114610c7357600080fd5b81835260006001600160fb1b03831115610e8e57600080fd5b8260051b80836020870137939093016020019392505050565b803563ffffffff81168114610c7357600080fd5b8183526000602080850194508260005b85811015610ef45763ffffffff610ee183610ea7565b1687529582019590820190600101610ecb565b509495945050505050565b8035825260006020610f1381840184610dac565b60e083870152610f2760e087018284610df2565b915050610f376040850185610e1b565b868303604088015280835290916000919084015b81831015610f735760ff610f5e85610e64565b16815292840192600192909201918401610f4b565b610f806060880188610dac565b955093508781036060890152610f97818686610df2565b945050505050610faa6080840184610e1b565b8583036080870152610fbd838284610e75565b92505050610fce60a0840184610e1b565b85830360a0870152610fe1838284610ebb565b9250505060c083013560c08501528091505092915050565b60208152600061100c6020830184610eff565b9392505050565b6060815260006110266060830186610eff565b60208301949094525060400152919050565b80518015158114610c7357600080fd5b634e487b7160e01b600052604160045260246000fd5b60005b83811015611079578181015183820152602001611061565b50506000910152565b6000806040838503121561109557600080fd5b61109e83611038565b9150602083015167ffffffffffffffff808211156110bb57600080fd5b818501915085601f8301126110cf57600080fd5b8151818111156110e1576110e1611048565b604051601f8201601f19908116603f0116810190838211818310171561110957611109611048565b8160405282815288602084870101111561112257600080fd5b61113383602083016020880161105e565b80955050505050509250929050565b602081526000825180602084015261116181604085016020870161105e565b601f01601f19169190910160400192915050565b6000808335601e1984360301811261118c57600080fd5b83018035915067ffffffffffffffff8211156111a757600080fd5b6020019150600581901b360382131561048557600080fd5b818103818111156108af576108af610d83565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156111fa57600080fd5b61100c82610ea7565b60006020828403121561121557600080fd5b81516001600160a01b038116811461100c57600080fd5b60006020828403121561123e57600080fd5b61100c82610e64565b60ff82811682821603908111156108af576108af610d83565b60006001820161127257611272610d83565b5060010190565b60006020828403121561128b57600080fd5b61100c8261103856fea26469706673582212200d5dae1b2939600e386623ef7defde718cd565d9d3a7e956d5adf754ff7891af64736f6c63430008110033",
|
|
189
|
+
"devdoc": {
|
|
190
|
+
"kind": "dev",
|
|
191
|
+
"methods": {
|
|
192
|
+
"approveResult(BeaconDkg.Data storage,BeaconDkg.Result)": {
|
|
193
|
+
"details": "Can be called after a challenge period for the submitted result.",
|
|
194
|
+
"params": {
|
|
195
|
+
"result": "Result to approve. Must match the submitted result stored during `submitResult`."
|
|
196
|
+
},
|
|
197
|
+
"returns": {
|
|
198
|
+
"misbehavedMembers": "Identifiers of members who misbehaved during DKG."
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
"challengeResult(BeaconDkg.Data storage,BeaconDkg.Result)": {
|
|
202
|
+
"details": "Can be called during a challenge period for the submitted result.",
|
|
203
|
+
"params": {
|
|
204
|
+
"result": "Result to challenge. Must match the submitted result stored during `submitResult`."
|
|
205
|
+
},
|
|
206
|
+
"returns": {
|
|
207
|
+
"maliciousResultHash": "Hash of the malicious result.",
|
|
208
|
+
"maliciousSubmitter": "Identifier of the malicious submitter."
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
"stateVariables": {
|
|
213
|
+
"groupSize": {
|
|
214
|
+
"details": "Size of a group in the threshold relay."
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
"version": 1
|
|
218
|
+
},
|
|
219
|
+
"userdoc": {
|
|
220
|
+
"kind": "user",
|
|
221
|
+
"methods": {
|
|
222
|
+
"approveResult(BeaconDkg.Data storage,BeaconDkg.Result)": {
|
|
223
|
+
"notice": "Approves DKG result. Can be called when the challenge period for the submitted result is finished. Considers the submitted result as valid. For the first `submitterPrecedencePeriodLength` blocks after the end of the challenge period can be called only by the DKG result submitter. After that time, can be called by anyone."
|
|
224
|
+
},
|
|
225
|
+
"challengeResult(BeaconDkg.Data storage,BeaconDkg.Result)": {
|
|
226
|
+
"notice": "Challenges DKG result. If the submitted result is proved to be invalid it reverts the DKG back to the result submission phase."
|
|
227
|
+
},
|
|
228
|
+
"offchainDkgTime()": {
|
|
229
|
+
"notice": "Time in blocks after which DKG result is complete and ready to be"
|
|
230
|
+
},
|
|
231
|
+
"submitResult(BeaconDkg.Data storage,BeaconDkg.Result)": {
|
|
232
|
+
"notice": "Allows to submit a DKG result. The submitted result does not go through a validation and before it gets accepted, it needs to wait through the challenge period during which everyone has a chance to challenge the result as invalid one. Submitter of the result needs to be in the sortition pool and if the result gets challenged, the submitter will get slashed."
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
"version": 1
|
|
236
|
+
},
|
|
237
|
+
"storageLayout": {
|
|
238
|
+
"storage": [],
|
|
239
|
+
"types": null
|
|
240
|
+
}
|
|
241
|
+
}
|