@keep-network/tbtc-v2 1.6.0-dev.21 → 1.6.0-dev.22
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/BLS.json +1 -1
- package/artifacts/Bank.json +3 -3
- package/artifacts/BeaconAuthorization.json +1 -1
- package/artifacts/BeaconDkg.json +1 -1
- package/artifacts/BeaconDkgValidator.json +1 -1
- package/artifacts/BeaconInactivity.json +1 -1
- package/artifacts/BeaconSortitionPool.json +3 -3
- package/artifacts/Bridge.json +5 -5
- package/artifacts/BridgeGovernance.json +2 -2
- package/artifacts/BridgeGovernanceParameters.json +2 -2
- package/artifacts/Deposit.json +2 -2
- package/artifacts/DepositSweep.json +2 -2
- package/artifacts/DonationVault.json +3 -3
- package/artifacts/EcdsaDkgValidator.json +1 -1
- package/artifacts/EcdsaInactivity.json +1 -1
- package/artifacts/EcdsaSortitionPool.json +3 -3
- package/artifacts/Fraud.json +2 -2
- package/artifacts/LightRelay.json +18 -18
- package/artifacts/LightRelayMaintainerProxy.json +8 -8
- package/artifacts/MaintainerProxy.json +19 -19
- package/artifacts/MovingFunds.json +2 -2
- package/artifacts/NuCypherToken.json +2 -2
- package/artifacts/RandomBeacon.json +2 -2
- package/artifacts/RandomBeaconChaosnet.json +2 -2
- package/artifacts/RandomBeaconGovernance.json +2 -2
- package/artifacts/Redemption.json +2 -2
- package/artifacts/ReimbursementPool.json +2 -2
- package/artifacts/T.json +2 -2
- package/artifacts/TBTC.json +3 -3
- package/artifacts/TBTCToken.json +3 -3
- package/artifacts/TBTCVault.json +23 -23
- package/artifacts/TokenStaking.json +1 -1
- package/artifacts/TokenholderGovernor.json +9 -9
- package/artifacts/TokenholderTimelock.json +8 -8
- package/artifacts/VendingMachine.json +3 -3
- package/artifacts/VendingMachineNuCypher.json +1 -1
- package/artifacts/VendingMachineV2.json +3 -3
- package/artifacts/VendingMachineV3.json +3 -3
- package/artifacts/WalletProposalValidator.json +2 -2
- package/artifacts/WalletRegistry.json +5 -5
- package/artifacts/WalletRegistryGovernance.json +2 -2
- package/artifacts/Wallets.json +2 -2
- package/artifacts/solcInputs/{cb0913695c554a7e8ed64fcc9024fae5.json → dd1c38c53a7547fe3e334d72c1e4d8e1.json} +1 -1
- package/build/contracts/GovernanceUtils.sol/GovernanceUtils.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/OutboundTx.dbg.json +1 -1
- package/build/contracts/bridge/Redemption.sol/Redemption.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/AbstractTBTCDepositor.sol/AbstractTBTCDepositor.json +0 -44
- 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/L2TBTC.sol/L2TBTC.dbg.json +1 -1
- package/build/contracts/l2/L2WormholeGateway.sol/IWormholeTokenBridge.dbg.json +1 -1
- package/build/contracts/l2/L2WormholeGateway.sol/L2WormholeGateway.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/MockBridge.json +2 -2
- package/build/contracts/test/TestTBTCDepositor.sol/MockTBTCVault.dbg.json +1 -1
- package/build/contracts/test/TestTBTCDepositor.sol/MockTBTCVault.json +2 -2
- package/build/contracts/test/TestTBTCDepositor.sol/TestTBTCDepositor.dbg.json +1 -1
- package/build/contracts/test/TestTBTCDepositor.sol/TestTBTCDepositor.json +2 -46
- 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/integrator/AbstractTBTCDepositor.sol +0 -22
- package/export/artifacts/contracts/bridge/VendingMachine.sol/VendingMachine.json +6 -6
- package/export/artifacts/contracts/bridge/VendingMachineV2.sol/VendingMachineV2.json +6 -6
- package/export/artifacts/contracts/bridge/VendingMachineV3.sol/VendingMachineV3.json +6 -6
- package/export/artifacts/contracts/l2/L2TBTC.sol/L2TBTC.json +40 -40
- package/export/artifacts/contracts/l2/L2WormholeGateway.sol/L2WormholeGateway.json +47 -47
- package/export/artifacts/contracts/maintainer/MaintainerProxy.sol/MaintainerProxy.json +88 -88
- package/export/artifacts/contracts/relay/LightRelay.sol/LightRelay.json +57 -57
- package/export/artifacts/contracts/relay/LightRelayMaintainerProxy.sol/LightRelayMaintainerProxy.json +31 -31
- package/export/artifacts/contracts/test/BankStub.sol/BankStub.json +2 -2
- package/export/artifacts/contracts/test/BridgeStub.sol/BridgeStub.json +30 -30
- package/export/artifacts/contracts/test/HeartbeatStub.sol/HeartbeatStub.json +2 -2
- package/export/artifacts/contracts/test/LightRelayStub.sol/LightRelayStub.json +59 -59
- package/export/artifacts/contracts/test/ReceiveApprovalStub.sol/ReceiveApprovalStub.json +7 -7
- package/export/artifacts/contracts/test/SepoliaLightRelay.sol/SepoliaLightRelay.json +59 -59
- package/export/artifacts/contracts/test/SystemTestRelay.sol/SystemTestRelay.json +14 -14
- package/export/artifacts/contracts/test/TestBitcoinTx.sol/TestBitcoinTx.json +5 -5
- package/export/artifacts/contracts/test/TestERC20.sol/TestERC20.json +6 -6
- package/export/artifacts/contracts/test/TestERC721.sol/TestERC721.json +8 -8
- package/export/artifacts/contracts/test/TestEcdsaLib.sol/TestEcdsaLib.json +2 -2
- package/export/artifacts/contracts/test/TestTBTCDepositor.sol/MockBridge.json +36 -36
- package/export/artifacts/contracts/test/TestTBTCDepositor.sol/MockTBTCVault.json +23 -23
- package/export/artifacts/contracts/test/TestTBTCDepositor.sol/TestTBTCDepositor.json +935 -1260
- package/export/artifacts/contracts/test/WormholeBridgeStub.sol/WormholeBridgeStub.json +37 -37
- package/export/artifacts/contracts/token/TBTC.sol/TBTC.json +2 -2
- package/export/artifacts/contracts/vault/DonationVault.sol/DonationVault.json +11 -11
- package/export/artifacts/contracts/vault/TBTCVault.sol/TBTCVault.json +135 -135
- package/export/typechain/factories/AbstractTBTCDepositor__factory.js +0 -44
- package/export/typechain/factories/MockBridge__factory.js +1 -1
- package/export/typechain/factories/MockTBTCVault__factory.js +1 -1
- package/export/typechain/factories/TestTBTCDepositor__factory.js +1 -45
- package/package.json +1 -1
|
@@ -314,7 +314,7 @@
|
|
|
314
314
|
"content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >0.0.0;\nimport '@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol';\n"
|
|
315
315
|
},
|
|
316
316
|
"contracts/integrator/AbstractTBTCDepositor.sol": {
|
|
317
|
-
"content": "// SPDX-License-Identifier: GPL-3.0-only\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n\npragma solidity ^0.8.0;\n\nimport {BTCUtils} from \"@keep-network/bitcoin-spv-sol/contracts/BTCUtils.sol\";\n\nimport \"./IBridge.sol\";\nimport \"./ITBTCVault.sol\";\n\n/// @title Abstract AbstractTBTCDepositor contract.\n/// @notice This abstract contract is meant to facilitate integration of protocols\n/// aiming to use tBTC as an underlying Bitcoin bridge.\n///\n/// Such an integrator is supposed to:\n/// - Create a child contract inheriting from this abstract contract\n/// - Call the `__AbstractTBTCDepositor_initialize` initializer function\n/// - Use the `_initializeDeposit` and `_finalizeDeposit` as part of their\n/// business logic in order to initialize and finalize deposits.\n///\n/// @dev Example usage:\n/// ```\n/// // Example upgradeable integrator contract.\n/// contract ExampleTBTCIntegrator is AbstractTBTCDepositor, Initializable {\n/// /// @custom:oz-upgrades-unsafe-allow constructor\n/// constructor() {\n/// // Prevents the contract from being initialized again.\n/// _disableInitializers();\n/// }\n///\n/// function initialize(\n/// address _bridge,\n/// address _tbtcVault\n/// ) external initializer {\n/// __AbstractTBTCDepositor_initialize(_bridge, _tbtcVault);\n/// }\n///\n/// function startProcess(\n/// IBridgeTypes.BitcoinTxInfo calldata fundingTx,\n/// IBridgeTypes.DepositRevealInfo calldata reveal\n/// ) external {\n/// // Embed necessary context as extra data.\n/// bytes32 extraData = ...;\n///\n/// uint256 depositKey = _initializeDeposit(\n/// fundingTx,\n/// reveal,\n/// extraData\n/// );\n///\n/// // Use the depositKey to track the process.\n/// }\n///\n/// function finalizeProcess(uint256 depositKey) external {\n/// // Ensure the function cannot be called for the same deposit\n/// // twice.\n///\n/// (\n/// uint256 initialDepositAmount,\n/// uint256 tbtcAmount,\n/// bytes32 extraData\n/// ) = _finalizeDeposit(depositKey);\n///\n/// // Do something with the minted TBTC using context\n/// // embedded in the extraData.\n/// }\n/// }\nabstract contract AbstractTBTCDepositor {\n using BTCUtils for bytes;\n\n /// @notice Multiplier to convert satoshi to TBTC token units.\n uint256 public constant SATOSHI_MULTIPLIER = 10**10;\n\n /// @notice Bridge contract address.\n IBridge public bridge;\n /// @notice TBTCVault contract address.\n ITBTCVault public tbtcVault;\n\n // Reserved storage space that allows adding more variables without affecting\n // the storage layout of the child contracts. The convention from OpenZeppelin\n // suggests the storage space should add up to 50 slots. If more variables are\n // added in the upcoming versions one need to reduce the array size accordingly.\n // See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n // slither-disable-next-line unused-state\n uint256[47] private __gap;\n\n event DepositInitialized(uint256 indexed depositKey, uint32 initializedAt);\n\n event DepositFinalized(\n uint256 indexed depositKey,\n uint256 tbtcAmount,\n uint32 finalizedAt\n );\n\n /// @notice Initializes the contract. MUST BE CALLED from the child\n /// contract initializer.\n // slither-disable-next-line dead-code\n function __AbstractTBTCDepositor_initialize(\n address _bridge,\n address _tbtcVault\n ) internal {\n require(\n address(bridge) == address(0) && address(tbtcVault) == address(0),\n \"AbstractTBTCDepositor already initialized\"\n );\n\n require(_bridge != address(0), \"Bridge address cannot be zero\");\n require(_tbtcVault != address(0), \"TBTCVault address cannot be zero\");\n\n bridge = IBridge(_bridge);\n tbtcVault = ITBTCVault(_tbtcVault);\n }\n\n /// @notice Initializes a deposit by revealing it to the Bridge.\n /// @param fundingTx Bitcoin funding transaction data, see `IBridgeTypes.BitcoinTxInfo`.\n /// @param reveal Deposit reveal data, see `IBridgeTypes.DepositRevealInfo` struct.\n /// @param extraData 32-byte deposit extra data.\n /// @return depositKey Deposit key computed as\n /// `keccak256(fundingTxHash | reveal.fundingOutputIndex)`. This\n /// key can be used to refer to the deposit in the Bridge and\n /// TBTCVault contracts.\n /// @dev Requirements:\n /// - The revealed vault address must match the TBTCVault address,\n /// - All requirements from {Bridge#revealDepositWithExtraData}\n /// function must be met.\n /// @dev This function doesn't validate if a deposit has been initialized before,\n /// as the Bridge won't allow the same deposit to be revealed twice.\n // slither-disable-next-line dead-code\n function _initializeDeposit(\n IBridgeTypes.BitcoinTxInfo calldata fundingTx,\n IBridgeTypes.DepositRevealInfo calldata reveal,\n bytes32 extraData\n ) internal returns (uint256) {\n require(reveal.vault == address(tbtcVault), \"Vault address mismatch\");\n\n uint256 depositKey = _calculateDepositKey(\n _calculateBitcoinTxHash(fundingTx),\n reveal.fundingOutputIndex\n );\n\n emit DepositInitialized(\n depositKey,\n /* solhint-disable-next-line not-rely-on-time */\n uint32(block.timestamp)\n );\n\n // The Bridge does not allow to reveal the same deposit twice and\n // revealed deposits stay there forever. The transaction will revert\n // if the deposit has already been revealed so, there is no need to do\n // an explicit check here.\n bridge.revealDepositWithExtraData(fundingTx, reveal, extraData);\n\n return depositKey;\n }\n\n /// @notice Finalizes a deposit by calculating the amount of TBTC minted\n /// for the deposit.\n /// @param depositKey Deposit key identifying the deposit.\n /// @return initialDepositAmount Amount of funding transaction deposit. In\n /// TBTC token decimals precision.\n /// @return tbtcAmount Approximate amount of TBTC minted for the deposit. In\n /// TBTC token decimals precision.\n /// @return extraData 32-byte deposit extra data.\n /// @dev Requirements:\n /// - The deposit must be initialized but not finalized\n /// (in the context of this contract) yet.\n /// - The deposit must be finalized on the Bridge side. That means the\n /// deposit must be either swept or optimistically minted.\n /// @dev THIS FUNCTION DOESN'T VALIDATE IF A DEPOSIT HAS BEEN FINALIZED BEFORE,\n /// IT IS A RESPONSIBILITY OF THE IMPLEMENTING CONTRACT TO ENSURE THIS\n /// FUNCTION WON'T BE CALLED TWICE FOR THE SAME DEPOSIT.\n /// @dev IMPORTANT NOTE: The tbtcAmount returned by this function is an\n /// approximation. See documentation of the `calculateTbtcAmount`\n /// responsible for calculating this value for more details.\n // slither-disable-next-line dead-code\n function _finalizeDeposit(uint256 depositKey)\n internal\n returns (\n uint256 initialDepositAmount,\n uint256 tbtcAmount,\n bytes32 extraData\n )\n {\n IBridgeTypes.DepositRequest memory deposit = bridge.deposits(\n depositKey\n );\n require(deposit.revealedAt != 0, \"Deposit not initialized\");\n\n (, uint64 finalizedAt) = tbtcVault.optimisticMintingRequests(\n depositKey\n );\n\n require(\n deposit.sweptAt != 0 || finalizedAt != 0,\n \"Deposit not finalized by the bridge\"\n );\n\n initialDepositAmount = deposit.amount * SATOSHI_MULTIPLIER;\n\n tbtcAmount = _calculateTbtcAmount(deposit.amount, deposit.treasuryFee);\n\n // slither-disable-next-line reentrancy-events\n emit DepositFinalized(\n depositKey,\n tbtcAmount,\n /* solhint-disable-next-line not-rely-on-time */\n uint32(block.timestamp)\n );\n\n extraData = deposit.extraData;\n }\n\n /// @notice Calculates the amount of TBTC minted for the deposit.\n /// @param depositAmountSat Deposit amount in satoshi (1e8 precision).\n /// This is the actual amount deposited by the deposit creator, i.e.\n /// the gross amount the Bridge's fees are cut from.\n /// @param depositTreasuryFeeSat Deposit treasury fee in satoshi (1e8 precision).\n /// This is an accurate value of the treasury fee that was actually\n /// cut upon minting.\n /// @return tbtcAmount Approximate amount of TBTC minted for the deposit.\n /// @dev IMPORTANT NOTE: The tbtcAmount returned by this function may\n /// not correspond to the actual amount of TBTC minted for the deposit.\n /// Although the treasury fee cut upon minting is known precisely,\n /// this is not the case for the optimistic minting fee and the Bitcoin\n /// transaction fee. To overcome that problem, this function just takes\n /// the current maximum allowed values of both fees, at the moment of deposit\n /// finalization. For the great majority of the deposits, such an\n /// algorithm will return a tbtcAmount slightly lesser than the\n /// actual amount of TBTC minted for the deposit. This will cause\n /// some TBTC to be left in the contract and ensure there is enough\n /// liquidity to finalize the deposit. However, in some rare cases,\n /// where the actual values of those fees change between the deposit\n /// minting and finalization, the tbtcAmount returned by this function\n /// may be greater than the actual amount of TBTC minted for the deposit.\n /// If this happens and the reserve coming from previous deposits\n /// leftovers does not provide enough liquidity, the deposit will have\n /// to wait for finalization until the reserve is refilled by subsequent\n /// deposits or a manual top-up. The integrator is responsible for\n /// handling such cases.\n // slither-disable-next-line dead-code\n function _calculateTbtcAmount(\n uint64 depositAmountSat,\n uint64 depositTreasuryFeeSat\n ) internal view virtual returns (uint256) {\n // Both deposit amount and treasury fee are in the 1e8 satoshi precision.\n // We need to convert them to the 1e18 TBTC precision.\n uint256 amountSubTreasury = (depositAmountSat - depositTreasuryFeeSat) *\n SATOSHI_MULTIPLIER;\n\n uint256 omFeeDivisor = tbtcVault.optimisticMintingFeeDivisor();\n uint256 omFee = omFeeDivisor > 0\n ? (amountSubTreasury / omFeeDivisor)\n : 0;\n\n // The deposit transaction max fee is in the 1e8 satoshi precision.\n // We need to convert them to the 1e18 TBTC precision.\n (, , uint64 depositTxMaxFee, ) = bridge.depositParameters();\n uint256 txMaxFee = depositTxMaxFee * SATOSHI_MULTIPLIER;\n\n return amountSubTreasury - omFee - txMaxFee;\n }\n\n /// @notice Calculates the deposit key for the given funding transaction\n /// hash and funding output index.\n /// @param fundingTxHash Funding transaction hash.\n /// @param fundingOutputIndex Funding output index.\n /// @return depositKey Deposit key computed as\n /// `keccak256(fundingTxHash | reveal.fundingOutputIndex)`. This\n /// key can be used to refer to the deposit in the Bridge and\n /// TBTCVault contracts.\n // slither-disable-next-line dead-code\n function _calculateDepositKey(\n bytes32 fundingTxHash,\n uint32 fundingOutputIndex\n ) internal pure returns (uint256) {\n return\n uint256(\n keccak256(abi.encodePacked(fundingTxHash, fundingOutputIndex))\n );\n }\n\n /// @notice Calculates the Bitcoin transaction hash for the given Bitcoin\n /// transaction data.\n /// @param txInfo Bitcoin transaction data, see `IBridgeTypes.BitcoinTxInfo` struct.\n /// @return txHash Bitcoin transaction hash.\n // slither-disable-next-line dead-code\n function _calculateBitcoinTxHash(IBridgeTypes.BitcoinTxInfo calldata txInfo)\n internal\n view\n returns (bytes32)\n {\n return\n abi\n .encodePacked(\n txInfo.version,\n txInfo.inputVector,\n txInfo.outputVector,\n txInfo.locktime\n )\n .hash256View();\n }\n}\n"
|
|
317
|
+
"content": "// SPDX-License-Identifier: GPL-3.0-only\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n\npragma solidity ^0.8.0;\n\nimport {BTCUtils} from \"@keep-network/bitcoin-spv-sol/contracts/BTCUtils.sol\";\n\nimport \"./IBridge.sol\";\nimport \"./ITBTCVault.sol\";\n\n/// @title Abstract AbstractTBTCDepositor contract.\n/// @notice This abstract contract is meant to facilitate integration of protocols\n/// aiming to use tBTC as an underlying Bitcoin bridge.\n///\n/// Such an integrator is supposed to:\n/// - Create a child contract inheriting from this abstract contract\n/// - Call the `__AbstractTBTCDepositor_initialize` initializer function\n/// - Use the `_initializeDeposit` and `_finalizeDeposit` as part of their\n/// business logic in order to initialize and finalize deposits.\n///\n/// @dev Example usage:\n/// ```\n/// // Example upgradeable integrator contract.\n/// contract ExampleTBTCIntegrator is AbstractTBTCDepositor, Initializable {\n/// /// @custom:oz-upgrades-unsafe-allow constructor\n/// constructor() {\n/// // Prevents the contract from being initialized again.\n/// _disableInitializers();\n/// }\n///\n/// function initialize(\n/// address _bridge,\n/// address _tbtcVault\n/// ) external initializer {\n/// __AbstractTBTCDepositor_initialize(_bridge, _tbtcVault);\n/// }\n///\n/// function startProcess(\n/// IBridgeTypes.BitcoinTxInfo calldata fundingTx,\n/// IBridgeTypes.DepositRevealInfo calldata reveal\n/// ) external {\n/// // Embed necessary context as extra data.\n/// bytes32 extraData = ...;\n///\n/// uint256 depositKey = _initializeDeposit(\n/// fundingTx,\n/// reveal,\n/// extraData\n/// );\n///\n/// // Use the depositKey to track the process.\n/// }\n///\n/// function finalizeProcess(uint256 depositKey) external {\n/// // Ensure the function cannot be called for the same deposit\n/// // twice.\n///\n/// (\n/// uint256 initialDepositAmount,\n/// uint256 tbtcAmount,\n/// bytes32 extraData\n/// ) = _finalizeDeposit(depositKey);\n///\n/// // Do something with the minted TBTC using context\n/// // embedded in the extraData.\n/// }\n/// }\nabstract contract AbstractTBTCDepositor {\n using BTCUtils for bytes;\n\n /// @notice Multiplier to convert satoshi to TBTC token units.\n uint256 public constant SATOSHI_MULTIPLIER = 10**10;\n\n /// @notice Bridge contract address.\n IBridge public bridge;\n /// @notice TBTCVault contract address.\n ITBTCVault public tbtcVault;\n\n // Reserved storage space that allows adding more variables without affecting\n // the storage layout of the child contracts. The convention from OpenZeppelin\n // suggests the storage space should add up to 50 slots. If more variables are\n // added in the upcoming versions one need to reduce the array size accordingly.\n // See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n // slither-disable-next-line unused-state\n uint256[47] private __gap;\n\n /// @notice Initializes the contract. MUST BE CALLED from the child\n /// contract initializer.\n // slither-disable-next-line dead-code\n function __AbstractTBTCDepositor_initialize(\n address _bridge,\n address _tbtcVault\n ) internal {\n require(\n address(bridge) == address(0) && address(tbtcVault) == address(0),\n \"AbstractTBTCDepositor already initialized\"\n );\n\n require(_bridge != address(0), \"Bridge address cannot be zero\");\n require(_tbtcVault != address(0), \"TBTCVault address cannot be zero\");\n\n bridge = IBridge(_bridge);\n tbtcVault = ITBTCVault(_tbtcVault);\n }\n\n /// @notice Initializes a deposit by revealing it to the Bridge.\n /// @param fundingTx Bitcoin funding transaction data, see `IBridgeTypes.BitcoinTxInfo`.\n /// @param reveal Deposit reveal data, see `IBridgeTypes.DepositRevealInfo` struct.\n /// @param extraData 32-byte deposit extra data.\n /// @return depositKey Deposit key computed as\n /// `keccak256(fundingTxHash | reveal.fundingOutputIndex)`. This\n /// key can be used to refer to the deposit in the Bridge and\n /// TBTCVault contracts.\n /// @dev Requirements:\n /// - The revealed vault address must match the TBTCVault address,\n /// - All requirements from {Bridge#revealDepositWithExtraData}\n /// function must be met.\n /// @dev This function doesn't validate if a deposit has been initialized before,\n /// as the Bridge won't allow the same deposit to be revealed twice.\n // slither-disable-next-line dead-code\n function _initializeDeposit(\n IBridgeTypes.BitcoinTxInfo calldata fundingTx,\n IBridgeTypes.DepositRevealInfo calldata reveal,\n bytes32 extraData\n ) internal returns (uint256) {\n require(reveal.vault == address(tbtcVault), \"Vault address mismatch\");\n\n uint256 depositKey = _calculateDepositKey(\n _calculateBitcoinTxHash(fundingTx),\n reveal.fundingOutputIndex\n );\n\n // The Bridge does not allow to reveal the same deposit twice and\n // revealed deposits stay there forever. The transaction will revert\n // if the deposit has already been revealed so, there is no need to do\n // an explicit check here.\n bridge.revealDepositWithExtraData(fundingTx, reveal, extraData);\n\n return depositKey;\n }\n\n /// @notice Finalizes a deposit by calculating the amount of TBTC minted\n /// for the deposit.\n /// @param depositKey Deposit key identifying the deposit.\n /// @return initialDepositAmount Amount of funding transaction deposit. In\n /// TBTC token decimals precision.\n /// @return tbtcAmount Approximate amount of TBTC minted for the deposit. In\n /// TBTC token decimals precision.\n /// @return extraData 32-byte deposit extra data.\n /// @dev Requirements:\n /// - The deposit must be initialized but not finalized\n /// (in the context of this contract) yet.\n /// - The deposit must be finalized on the Bridge side. That means the\n /// deposit must be either swept or optimistically minted.\n /// @dev THIS FUNCTION DOESN'T VALIDATE IF A DEPOSIT HAS BEEN FINALIZED BEFORE,\n /// IT IS A RESPONSIBILITY OF THE IMPLEMENTING CONTRACT TO ENSURE THIS\n /// FUNCTION WON'T BE CALLED TWICE FOR THE SAME DEPOSIT.\n /// @dev IMPORTANT NOTE: The tbtcAmount returned by this function is an\n /// approximation. See documentation of the `calculateTbtcAmount`\n /// responsible for calculating this value for more details.\n // slither-disable-next-line dead-code\n function _finalizeDeposit(uint256 depositKey)\n internal\n returns (\n uint256 initialDepositAmount,\n uint256 tbtcAmount,\n bytes32 extraData\n )\n {\n IBridgeTypes.DepositRequest memory deposit = bridge.deposits(\n depositKey\n );\n require(deposit.revealedAt != 0, \"Deposit not initialized\");\n\n (, uint64 finalizedAt) = tbtcVault.optimisticMintingRequests(\n depositKey\n );\n\n require(\n deposit.sweptAt != 0 || finalizedAt != 0,\n \"Deposit not finalized by the bridge\"\n );\n\n initialDepositAmount = deposit.amount * SATOSHI_MULTIPLIER;\n\n tbtcAmount = _calculateTbtcAmount(deposit.amount, deposit.treasuryFee);\n\n extraData = deposit.extraData;\n }\n\n /// @notice Calculates the amount of TBTC minted for the deposit.\n /// @param depositAmountSat Deposit amount in satoshi (1e8 precision).\n /// This is the actual amount deposited by the deposit creator, i.e.\n /// the gross amount the Bridge's fees are cut from.\n /// @param depositTreasuryFeeSat Deposit treasury fee in satoshi (1e8 precision).\n /// This is an accurate value of the treasury fee that was actually\n /// cut upon minting.\n /// @return tbtcAmount Approximate amount of TBTC minted for the deposit.\n /// @dev IMPORTANT NOTE: The tbtcAmount returned by this function may\n /// not correspond to the actual amount of TBTC minted for the deposit.\n /// Although the treasury fee cut upon minting is known precisely,\n /// this is not the case for the optimistic minting fee and the Bitcoin\n /// transaction fee. To overcome that problem, this function just takes\n /// the current maximum allowed values of both fees, at the moment of deposit\n /// finalization. For the great majority of the deposits, such an\n /// algorithm will return a tbtcAmount slightly lesser than the\n /// actual amount of TBTC minted for the deposit. This will cause\n /// some TBTC to be left in the contract and ensure there is enough\n /// liquidity to finalize the deposit. However, in some rare cases,\n /// where the actual values of those fees change between the deposit\n /// minting and finalization, the tbtcAmount returned by this function\n /// may be greater than the actual amount of TBTC minted for the deposit.\n /// If this happens and the reserve coming from previous deposits\n /// leftovers does not provide enough liquidity, the deposit will have\n /// to wait for finalization until the reserve is refilled by subsequent\n /// deposits or a manual top-up. The integrator is responsible for\n /// handling such cases.\n // slither-disable-next-line dead-code\n function _calculateTbtcAmount(\n uint64 depositAmountSat,\n uint64 depositTreasuryFeeSat\n ) internal view virtual returns (uint256) {\n // Both deposit amount and treasury fee are in the 1e8 satoshi precision.\n // We need to convert them to the 1e18 TBTC precision.\n uint256 amountSubTreasury = (depositAmountSat - depositTreasuryFeeSat) *\n SATOSHI_MULTIPLIER;\n\n uint256 omFeeDivisor = tbtcVault.optimisticMintingFeeDivisor();\n uint256 omFee = omFeeDivisor > 0\n ? (amountSubTreasury / omFeeDivisor)\n : 0;\n\n // The deposit transaction max fee is in the 1e8 satoshi precision.\n // We need to convert them to the 1e18 TBTC precision.\n (, , uint64 depositTxMaxFee, ) = bridge.depositParameters();\n uint256 txMaxFee = depositTxMaxFee * SATOSHI_MULTIPLIER;\n\n return amountSubTreasury - omFee - txMaxFee;\n }\n\n /// @notice Calculates the deposit key for the given funding transaction\n /// hash and funding output index.\n /// @param fundingTxHash Funding transaction hash.\n /// @param fundingOutputIndex Funding output index.\n /// @return depositKey Deposit key computed as\n /// `keccak256(fundingTxHash | reveal.fundingOutputIndex)`. This\n /// key can be used to refer to the deposit in the Bridge and\n /// TBTCVault contracts.\n // slither-disable-next-line dead-code\n function _calculateDepositKey(\n bytes32 fundingTxHash,\n uint32 fundingOutputIndex\n ) internal pure returns (uint256) {\n return\n uint256(\n keccak256(abi.encodePacked(fundingTxHash, fundingOutputIndex))\n );\n }\n\n /// @notice Calculates the Bitcoin transaction hash for the given Bitcoin\n /// transaction data.\n /// @param txInfo Bitcoin transaction data, see `IBridgeTypes.BitcoinTxInfo` struct.\n /// @return txHash Bitcoin transaction hash.\n // slither-disable-next-line dead-code\n function _calculateBitcoinTxHash(IBridgeTypes.BitcoinTxInfo calldata txInfo)\n internal\n view\n returns (bytes32)\n {\n return\n abi\n .encodePacked(\n txInfo.version,\n txInfo.inputVector,\n txInfo.outputVector,\n txInfo.locktime\n )\n .hash256View();\n }\n}\n"
|
|
318
318
|
},
|
|
319
319
|
"contracts/integrator/IBridge.sol": {
|
|
320
320
|
"content": "// SPDX-License-Identifier: GPL-3.0-only\n\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ██████████████ ▐████▌ ██████████████\n// ██████████████ ▐████▌ ██████████████\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n// ▐████▌ ▐████▌\n\npragma solidity ^0.8.0;\n\n/// @notice Namespace which groups all types relevant to the IBridge interface.\n/// @dev This is a mirror of the real types used in the Bridge contract.\n/// This way, the `integrator` subpackage does not need to import\n/// anything from the `bridge` subpackage and explicitly depend on it.\n/// This simplifies the dependency graph for integrators.\nlibrary IBridgeTypes {\n /// @dev See bridge/BitcoinTx.sol#Info\n struct BitcoinTxInfo {\n bytes4 version;\n bytes inputVector;\n bytes outputVector;\n bytes4 locktime;\n }\n\n /// @dev See bridge/Deposit.sol#DepositRevealInfo\n struct DepositRevealInfo {\n uint32 fundingOutputIndex;\n bytes8 blindingFactor;\n bytes20 walletPubKeyHash;\n bytes20 refundPubKeyHash;\n bytes4 refundLocktime;\n address vault;\n }\n\n /// @dev See bridge/Deposit.sol#DepositRequest\n struct DepositRequest {\n address depositor;\n uint64 amount;\n uint32 revealedAt;\n address vault;\n uint64 treasuryFee;\n uint32 sweptAt;\n bytes32 extraData;\n }\n}\n\n/// @notice Interface of the Bridge contract.\n/// @dev See bridge/Bridge.sol\ninterface IBridge {\n /// @dev See {Bridge#revealDepositWithExtraData}\n function revealDepositWithExtraData(\n IBridgeTypes.BitcoinTxInfo calldata fundingTx,\n IBridgeTypes.DepositRevealInfo calldata reveal,\n bytes32 extraData\n ) external;\n\n /// @dev See {Bridge#deposits}\n function deposits(uint256 depositKey)\n external\n view\n returns (IBridgeTypes.DepositRequest memory);\n\n /// @dev See {Bridge#depositParameters}\n function depositParameters()\n external\n view\n returns (\n uint64 depositDustThreshold,\n uint64 depositTreasuryFeeDivisor,\n uint64 depositTxMaxFee,\n uint32 depositRevealAheadPeriod\n );\n}\n"
|
|
@@ -3,50 +3,6 @@
|
|
|
3
3
|
"contractName": "AbstractTBTCDepositor",
|
|
4
4
|
"sourceName": "contracts/integrator/AbstractTBTCDepositor.sol",
|
|
5
5
|
"abi": [
|
|
6
|
-
{
|
|
7
|
-
"anonymous": false,
|
|
8
|
-
"inputs": [
|
|
9
|
-
{
|
|
10
|
-
"indexed": true,
|
|
11
|
-
"internalType": "uint256",
|
|
12
|
-
"name": "depositKey",
|
|
13
|
-
"type": "uint256"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"indexed": false,
|
|
17
|
-
"internalType": "uint256",
|
|
18
|
-
"name": "tbtcAmount",
|
|
19
|
-
"type": "uint256"
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
"indexed": false,
|
|
23
|
-
"internalType": "uint32",
|
|
24
|
-
"name": "finalizedAt",
|
|
25
|
-
"type": "uint32"
|
|
26
|
-
}
|
|
27
|
-
],
|
|
28
|
-
"name": "DepositFinalized",
|
|
29
|
-
"type": "event"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"anonymous": false,
|
|
33
|
-
"inputs": [
|
|
34
|
-
{
|
|
35
|
-
"indexed": true,
|
|
36
|
-
"internalType": "uint256",
|
|
37
|
-
"name": "depositKey",
|
|
38
|
-
"type": "uint256"
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"indexed": false,
|
|
42
|
-
"internalType": "uint32",
|
|
43
|
-
"name": "initializedAt",
|
|
44
|
-
"type": "uint32"
|
|
45
|
-
}
|
|
46
|
-
],
|
|
47
|
-
"name": "DepositInitialized",
|
|
48
|
-
"type": "event"
|
|
49
|
-
},
|
|
50
6
|
{
|
|
51
7
|
"inputs": [],
|
|
52
8
|
"name": "SATOSHI_MULTIPLIER",
|
|
@@ -217,8 +217,8 @@
|
|
|
217
217
|
"type": "function"
|
|
218
218
|
}
|
|
219
219
|
],
|
|
220
|
-
"bytecode": "
|
|
221
|
-
"deployedBytecode": "
|
|
220
|
+
"bytecode": "0x6080604052600180546001600160801b0319166903e8000000000000003217905534801561002c57600080fd5b50610fc38061003c6000396000f3fe608060405234801561001057600080fd5b50600436106100725760003560e01c8063b036c1ee11610050578063b036c1ee14610218578063bc8d07ca1461026d578063c42b64d01461028057600080fd5b80630bce769d1461007757806386f01439146100ab578063b02c43d0146100be575b600080fd5b6100a9610085366004610d39565b6001805467ffffffffffffffff191667ffffffffffffffff92909216919091179055565b005b6100a96100b9366004610d63565b6102c1565b61018f6100cc366004610dcc565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c08101919091525060009081526020818152604091829020825160e08101845281546001600160a01b03808216835267ffffffffffffffff600160a01b80840482169685019690965263ffffffff600160e01b9384900481169785019790975260018501549182166060850152948104909416608083015290920490921660a082015260029091015460c082015290565b60405161020f9190600060e0820190506001600160a01b03808451168352602084015167ffffffffffffffff80821660208601526040860151915063ffffffff80831660408701528360608801511660608701528160808801511660808701528060a08801511660a08701525050505060c083015160c083015292915050565b60405180910390f35b6100a9610226366004610d39565b6001805467ffffffffffffffff90921668010000000000000000027fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff909216919091179055565b6100a961027b366004610dcc565b6105ff565b600154604080516000808252602082018190526801000000000000000090930467ffffffffffffffff1691810191909152606081019190915260800161020f565b60006103266102d36020860186610de5565b6102e06020870187610e0f565b6102ed6040890189610e0f565b6102fd60808b0160608c01610de5565b60405160200161031296959493929190610e56565b604051602081830303815290604052610718565b90506000816103386020860186610e98565b60405160200161035f92919091825260e01b6001600160e01b031916602082015260240190565b60408051808303601f190181529181528151602092830120600081815292839052912054909150600160e01b900463ffffffff16156103e55760405162461bcd60e51b815260206004820152601860248201527f4465706f73697420616c72656164792072657665616c6564000000000000000060448201526064015b60405180910390fd5b60006104476103f76020870187610e98565b63ffffffff1661040a6040890189610e0f565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505061073f9050565b9050600061045482610923565b6040805160e0810182526000606082018190526080820181905260a080830182905260c08084019290925233835267ffffffffffffffff851660208401524263ffffffff1693830193909352929350916104b391908901908901610ebe565b6001600160a01b0316606082015260015467ffffffffffffffff166104d95760006104f0565b6001546104f09067ffffffffffffffff1683610efd565b67ffffffffffffffff90811660808301908152600060a0840181815260c085018a8152888352602083815260409384902087518154838a0151878b01516001600160a01b039384166001600160e01b031993841617600160a01b928c168302177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff908116600160e01b63ffffffff938416810291909117875560608e01516001880180549d519b51919097169c9095169b909b1798909b1690910296909617909816979094169095029590951790915551600290920191909155518581527f629cb19e19d844f2e8dd8aa5de26f5072bb49e6286c5206ebd7302da1dabc417910160405180910390a15050505050505050565b600081815260208190526040812054600160e01b900463ffffffff1690036106695760405162461bcd60e51b815260206004820152601460248201527f4465706f736974206e6f742072657665616c656400000000000000000000000060448201526064016103dc565b600081815260208190526040902060010154600160e01b900463ffffffff16156106d55760405162461bcd60e51b815260206004820152601560248201527f4465706f73697420616c7265616479207377657074000000000000000000000060448201526064016103dc565b600090815260208190526040902060010180547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16600160e01b4263ffffffff1602179055565b60006020600083516020850160025afa50602060006020600060025afa5050600051919050565b606060008061074d856109a2565b9092509050600182016107c85760405162461bcd60e51b815260206004820152602260248201527f52656164206f76657272756e20647572696e6720566172496e7420706172736960448201527f6e6700000000000000000000000000000000000000000000000000000000000060648201526084016103dc565b8084106108175760405162461bcd60e51b815260206004820152601160248201527f566f75742072656164206f76657272756e00000000000000000000000000000060448201526064016103dc565b600080610825846001610f32565b905060005b868110156108ad5761083c88836109b9565b9250600019830361088f5760405162461bcd60e51b815260206004820152601a60248201527f42616420566172496e7420696e207363726970745075626b657900000000000060448201526064016103dc565b6108998383610f32565b9150806108a581610f45565b91505061082a565b506108b887826109b9565b9150600019820361090b5760405162461bcd60e51b815260206004820152601a60248201527f42616420566172496e7420696e207363726970745075626b657900000000000060448201526064016103dc565b610916878284610a26565b9450505050505b92915050565b60008061092f83610af4565b60c01c9050600061099a8264ff000000ff600882811c91821665ff000000ff009390911b92831617601090811b67ffffffffffffffff1666ff00ff00ff00ff9290921667ff00ff00ff00ff009093169290921790911c65ffff0000ffff1617602081811c91901b1790565b949350505050565b6000806109b0836000610b00565b91509150915091565b60006109c6826009610f32565b835110156109d7575060001961091d565b6000806109ee856109e9866008610f32565b610b00565b909250905060018201610a07576000199250505061091d565b80610a13836009610f32565b610a1d9190610f32565b95945050505050565b606081600003610a455750604080516020810190915260008152610aed565b6000610a518385610f32565b90508381118015610a63575080855110155b610aaf5760405162461bcd60e51b815260206004820152601360248201527f536c696365206f7574206f6620626f756e64730000000000000000000000000060448201526064016103dc565b604051915082604083010160405282825283850182038460208701018481015b80821015610ae857815183830152602082019150610acf565b505050505b9392505050565b600061091d8282610ca4565b6000806000610b0f8585610cb3565b90508060ff16600003610b44576000858581518110610b3057610b30610f5e565b016020015190935060f81c9150610c9d9050565b83610b50826001610f74565b60ff16610b5d9190610f32565b85511015610b745760001960009250925050610c9d565b60008160ff16600203610bb857610bad610b99610b92876001610f32565b8890610ca4565b62ffff0060e882901c1660f89190911c1790565b61ffff169050610c93565b8160ff16600403610c0757610bfa610bd4610b92876001610f32565b60d881901c63ff00ff001662ff00ff60e89290921c9190911617601081811b91901c1790565b63ffffffff169050610c93565b8160ff16600803610c9357610c86610c23610b92876001610f32565b60c01c64ff000000ff600882811c91821665ff000000ff009390911b92831617601090811b67ffffffffffffffff1666ff00ff00ff00ff9290921667ff00ff00ff00ff009093169290921790911c65ffff0000ffff1617602081811c91901b1790565b67ffffffffffffffff1690505b60ff909116925090505b9250929050565b6000610aed8383016020015190565b6000828281518110610cc757610cc7610f5e565b016020015160f81c60ff03610cde5750600861091d565b828281518110610cf057610cf0610f5e565b016020015160f81c60fe03610d075750600461091d565b828281518110610d1957610d19610f5e565b016020015160f81c60fd03610d305750600261091d565b50600092915050565b600060208284031215610d4b57600080fd5b813567ffffffffffffffff81168114610aed57600080fd5b6000806000838503610100811215610d7a57600080fd5b843567ffffffffffffffff811115610d9157600080fd5b850160808188031215610da357600080fd5b935060c0601f1982011215610db757600080fd5b5060208401915060e084013590509250925092565b600060208284031215610dde57600080fd5b5035919050565b600060208284031215610df757600080fd5b81356001600160e01b031981168114610aed57600080fd5b6000808335601e19843603018112610e2657600080fd5b83018035915067ffffffffffffffff821115610e4157600080fd5b602001915036819003821315610c9d57600080fd5b60006001600160e01b03198089168352868860048501378683016004810160008152868882375093169390920160048101939093525050600801949350505050565b600060208284031215610eaa57600080fd5b813563ffffffff81168114610aed57600080fd5b600060208284031215610ed057600080fd5b81356001600160a01b0381168114610aed57600080fd5b634e487b7160e01b600052601160045260246000fd5b600067ffffffffffffffff80841680610f2657634e487b7160e01b600052601260045260246000fd5b92169190910492915050565b8082018082111561091d5761091d610ee7565b600060018201610f5757610f57610ee7565b5060010190565b634e487b7160e01b600052603260045260246000fd5b60ff818116838216019081111561091d5761091d610ee756fea264697066735822122018a56609493fc4a7e661e4e08bf172783f61309bb4ead6c7fa5cab0342f7b25664736f6c63430008110033",
|
|
221
|
+
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100725760003560e01c8063b036c1ee11610050578063b036c1ee14610218578063bc8d07ca1461026d578063c42b64d01461028057600080fd5b80630bce769d1461007757806386f01439146100ab578063b02c43d0146100be575b600080fd5b6100a9610085366004610d39565b6001805467ffffffffffffffff191667ffffffffffffffff92909216919091179055565b005b6100a96100b9366004610d63565b6102c1565b61018f6100cc366004610dcc565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c08101919091525060009081526020818152604091829020825160e08101845281546001600160a01b03808216835267ffffffffffffffff600160a01b80840482169685019690965263ffffffff600160e01b9384900481169785019790975260018501549182166060850152948104909416608083015290920490921660a082015260029091015460c082015290565b60405161020f9190600060e0820190506001600160a01b03808451168352602084015167ffffffffffffffff80821660208601526040860151915063ffffffff80831660408701528360608801511660608701528160808801511660808701528060a08801511660a08701525050505060c083015160c083015292915050565b60405180910390f35b6100a9610226366004610d39565b6001805467ffffffffffffffff90921668010000000000000000027fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff909216919091179055565b6100a961027b366004610dcc565b6105ff565b600154604080516000808252602082018190526801000000000000000090930467ffffffffffffffff1691810191909152606081019190915260800161020f565b60006103266102d36020860186610de5565b6102e06020870187610e0f565b6102ed6040890189610e0f565b6102fd60808b0160608c01610de5565b60405160200161031296959493929190610e56565b604051602081830303815290604052610718565b90506000816103386020860186610e98565b60405160200161035f92919091825260e01b6001600160e01b031916602082015260240190565b60408051808303601f190181529181528151602092830120600081815292839052912054909150600160e01b900463ffffffff16156103e55760405162461bcd60e51b815260206004820152601860248201527f4465706f73697420616c72656164792072657665616c6564000000000000000060448201526064015b60405180910390fd5b60006104476103f76020870187610e98565b63ffffffff1661040a6040890189610e0f565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505061073f9050565b9050600061045482610923565b6040805160e0810182526000606082018190526080820181905260a080830182905260c08084019290925233835267ffffffffffffffff851660208401524263ffffffff1693830193909352929350916104b391908901908901610ebe565b6001600160a01b0316606082015260015467ffffffffffffffff166104d95760006104f0565b6001546104f09067ffffffffffffffff1683610efd565b67ffffffffffffffff90811660808301908152600060a0840181815260c085018a8152888352602083815260409384902087518154838a0151878b01516001600160a01b039384166001600160e01b031993841617600160a01b928c168302177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff908116600160e01b63ffffffff938416810291909117875560608e01516001880180549d519b51919097169c9095169b909b1798909b1690910296909617909816979094169095029590951790915551600290920191909155518581527f629cb19e19d844f2e8dd8aa5de26f5072bb49e6286c5206ebd7302da1dabc417910160405180910390a15050505050505050565b600081815260208190526040812054600160e01b900463ffffffff1690036106695760405162461bcd60e51b815260206004820152601460248201527f4465706f736974206e6f742072657665616c656400000000000000000000000060448201526064016103dc565b600081815260208190526040902060010154600160e01b900463ffffffff16156106d55760405162461bcd60e51b815260206004820152601560248201527f4465706f73697420616c7265616479207377657074000000000000000000000060448201526064016103dc565b600090815260208190526040902060010180547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16600160e01b4263ffffffff1602179055565b60006020600083516020850160025afa50602060006020600060025afa5050600051919050565b606060008061074d856109a2565b9092509050600182016107c85760405162461bcd60e51b815260206004820152602260248201527f52656164206f76657272756e20647572696e6720566172496e7420706172736960448201527f6e6700000000000000000000000000000000000000000000000000000000000060648201526084016103dc565b8084106108175760405162461bcd60e51b815260206004820152601160248201527f566f75742072656164206f76657272756e00000000000000000000000000000060448201526064016103dc565b600080610825846001610f32565b905060005b868110156108ad5761083c88836109b9565b9250600019830361088f5760405162461bcd60e51b815260206004820152601a60248201527f42616420566172496e7420696e207363726970745075626b657900000000000060448201526064016103dc565b6108998383610f32565b9150806108a581610f45565b91505061082a565b506108b887826109b9565b9150600019820361090b5760405162461bcd60e51b815260206004820152601a60248201527f42616420566172496e7420696e207363726970745075626b657900000000000060448201526064016103dc565b610916878284610a26565b9450505050505b92915050565b60008061092f83610af4565b60c01c9050600061099a8264ff000000ff600882811c91821665ff000000ff009390911b92831617601090811b67ffffffffffffffff1666ff00ff00ff00ff9290921667ff00ff00ff00ff009093169290921790911c65ffff0000ffff1617602081811c91901b1790565b949350505050565b6000806109b0836000610b00565b91509150915091565b60006109c6826009610f32565b835110156109d7575060001961091d565b6000806109ee856109e9866008610f32565b610b00565b909250905060018201610a07576000199250505061091d565b80610a13836009610f32565b610a1d9190610f32565b95945050505050565b606081600003610a455750604080516020810190915260008152610aed565b6000610a518385610f32565b90508381118015610a63575080855110155b610aaf5760405162461bcd60e51b815260206004820152601360248201527f536c696365206f7574206f6620626f756e64730000000000000000000000000060448201526064016103dc565b604051915082604083010160405282825283850182038460208701018481015b80821015610ae857815183830152602082019150610acf565b505050505b9392505050565b600061091d8282610ca4565b6000806000610b0f8585610cb3565b90508060ff16600003610b44576000858581518110610b3057610b30610f5e565b016020015190935060f81c9150610c9d9050565b83610b50826001610f74565b60ff16610b5d9190610f32565b85511015610b745760001960009250925050610c9d565b60008160ff16600203610bb857610bad610b99610b92876001610f32565b8890610ca4565b62ffff0060e882901c1660f89190911c1790565b61ffff169050610c93565b8160ff16600403610c0757610bfa610bd4610b92876001610f32565b60d881901c63ff00ff001662ff00ff60e89290921c9190911617601081811b91901c1790565b63ffffffff169050610c93565b8160ff16600803610c9357610c86610c23610b92876001610f32565b60c01c64ff000000ff600882811c91821665ff000000ff009390911b92831617601090811b67ffffffffffffffff1666ff00ff00ff00ff9290921667ff00ff00ff00ff009093169290921790911c65ffff0000ffff1617602081811c91901b1790565b67ffffffffffffffff1690505b60ff909116925090505b9250929050565b6000610aed8383016020015190565b6000828281518110610cc757610cc7610f5e565b016020015160f81c60ff03610cde5750600861091d565b828281518110610cf057610cf0610f5e565b016020015160f81c60fe03610d075750600461091d565b828281518110610d1957610d19610f5e565b016020015160f81c60fd03610d305750600261091d565b50600092915050565b600060208284031215610d4b57600080fd5b813567ffffffffffffffff81168114610aed57600080fd5b6000806000838503610100811215610d7a57600080fd5b843567ffffffffffffffff811115610d9157600080fd5b850160808188031215610da357600080fd5b935060c0601f1982011215610db757600080fd5b5060208401915060e084013590509250925092565b600060208284031215610dde57600080fd5b5035919050565b600060208284031215610df757600080fd5b81356001600160e01b031981168114610aed57600080fd5b6000808335601e19843603018112610e2657600080fd5b83018035915067ffffffffffffffff821115610e4157600080fd5b602001915036819003821315610c9d57600080fd5b60006001600160e01b03198089168352868860048501378683016004810160008152868882375093169390920160048101939093525050600801949350505050565b600060208284031215610eaa57600080fd5b813563ffffffff81168114610aed57600080fd5b600060208284031215610ed057600080fd5b81356001600160a01b0381168114610aed57600080fd5b634e487b7160e01b600052601160045260246000fd5b600067ffffffffffffffff80841680610f2657634e487b7160e01b600052601260045260246000fd5b92169190910492915050565b8082018082111561091d5761091d610ee7565b600060018201610f5757610f57610ee7565b5060010190565b634e487b7160e01b600052603260045260246000fd5b60ff818116838216019081111561091d5761091d610ee756fea264697066735822122018a56609493fc4a7e661e4e08bf172783f61309bb4ead6c7fa5cab0342f7b25664736f6c63430008110033",
|
|
222
222
|
"linkReferences": {},
|
|
223
223
|
"deployedLinkReferences": {}
|
|
224
224
|
}
|
|
@@ -80,8 +80,8 @@
|
|
|
80
80
|
"type": "function"
|
|
81
81
|
}
|
|
82
82
|
],
|
|
83
|
-
"bytecode": "
|
|
84
|
-
"deployedBytecode": "
|
|
83
|
+
"bytecode": "0x60806040526001805463ffffffff1916606417905534801561002057600080fd5b5061038f806100306000396000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c80636c626aa4116100505780636c626aa4146100ab578063d5b0b0ce1461011a578063db4aa6cb1461014457600080fd5b806309b53f511461006c578063477ffd6514610096575b600080fd5b60015461007c9063ffffffff1681565b60405163ffffffff90911681526020015b60405180910390f35b6100a96100a4366004610313565b610157565b005b6100f96100b9366004610313565b6000908152602081815260409182902082518084019093525467ffffffffffffffff80821680855268010000000000000000909204169290910182905291565b6040805167ffffffffffffffff93841681529290911660208301520161008d565b6100a961012836600461032c565b6001805463ffffffff191663ffffffff92909216919091179055565b6100a9610152366004610313565b6101ed565b60008181526020819052604090205467ffffffffffffffff16156101c25760405162461bcd60e51b815260206004820152601660248201527f5265717565737420616c7265616479206578697374730000000000000000000060448201526064015b60405180910390fd5b6000908152602081905260409020805467ffffffffffffffff19164267ffffffffffffffff16179055565b60008181526020819052604081205467ffffffffffffffff1690036102545760405162461bcd60e51b815260206004820152601660248201527f5265717565737420646f6573206e6f742065786973740000000000000000000060448201526064016101b9565b60008181526020819052604090205468010000000000000000900467ffffffffffffffff16156102c65760405162461bcd60e51b815260206004820152601960248201527f5265717565737420616c72656164792066696e616c697a65640000000000000060448201526064016101b9565b600090815260208190526040902080547fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff16680100000000000000004267ffffffffffffffff1602179055565b60006020828403121561032557600080fd5b5035919050565b60006020828403121561033e57600080fd5b813563ffffffff8116811461035257600080fd5b939250505056fea2646970667358221220ada23ba2aeec2357f8967926a2601c02f2edb8990fed209807a1272ff4faaaf664736f6c63430008110033",
|
|
84
|
+
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100675760003560e01c80636c626aa4116100505780636c626aa4146100ab578063d5b0b0ce1461011a578063db4aa6cb1461014457600080fd5b806309b53f511461006c578063477ffd6514610096575b600080fd5b60015461007c9063ffffffff1681565b60405163ffffffff90911681526020015b60405180910390f35b6100a96100a4366004610313565b610157565b005b6100f96100b9366004610313565b6000908152602081815260409182902082518084019093525467ffffffffffffffff80821680855268010000000000000000909204169290910182905291565b6040805167ffffffffffffffff93841681529290911660208301520161008d565b6100a961012836600461032c565b6001805463ffffffff191663ffffffff92909216919091179055565b6100a9610152366004610313565b6101ed565b60008181526020819052604090205467ffffffffffffffff16156101c25760405162461bcd60e51b815260206004820152601660248201527f5265717565737420616c7265616479206578697374730000000000000000000060448201526064015b60405180910390fd5b6000908152602081905260409020805467ffffffffffffffff19164267ffffffffffffffff16179055565b60008181526020819052604081205467ffffffffffffffff1690036102545760405162461bcd60e51b815260206004820152601660248201527f5265717565737420646f6573206e6f742065786973740000000000000000000060448201526064016101b9565b60008181526020819052604090205468010000000000000000900467ffffffffffffffff16156102c65760405162461bcd60e51b815260206004820152601960248201527f5265717565737420616c72656164792066696e616c697a65640000000000000060448201526064016101b9565b600090815260208190526040902080547fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff16680100000000000000004267ffffffffffffffff1602179055565b60006020828403121561032557600080fd5b5035919050565b60006020828403121561033e57600080fd5b813563ffffffff8116811461035257600080fd5b939250505056fea2646970667358221220ada23ba2aeec2357f8967926a2601c02f2edb8990fed209807a1272ff4faaaf664736f6c63430008110033",
|
|
85
85
|
"linkReferences": {},
|
|
86
86
|
"deployedLinkReferences": {}
|
|
87
87
|
}
|