@keep-network/tbtc-v2 0.1.1-dev.45 → 0.1.1-dev.48

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.
Files changed (67) hide show
  1. package/artifacts/Bank.json +11 -11
  2. package/artifacts/Bridge.json +178 -146
  3. package/artifacts/Deposit.json +7 -7
  4. package/artifacts/EcdsaDkgValidator.json +1 -1
  5. package/artifacts/EcdsaInactivity.json +1 -1
  6. package/artifacts/Fraud.json +7 -7
  7. package/artifacts/KeepRegistry.json +1 -1
  8. package/artifacts/KeepStake.json +2 -2
  9. package/artifacts/KeepToken.json +2 -2
  10. package/artifacts/KeepTokenStaking.json +1 -1
  11. package/artifacts/MovingFunds.json +9 -9
  12. package/artifacts/NuCypherStakingEscrow.json +1 -1
  13. package/artifacts/NuCypherToken.json +2 -2
  14. package/artifacts/RandomBeaconStub.json +1 -1
  15. package/artifacts/Redemption.json +7 -7
  16. package/artifacts/ReimbursementPool.json +2 -2
  17. package/artifacts/Relay.json +11 -11
  18. package/artifacts/SortitionPool.json +2 -2
  19. package/artifacts/Sweep.json +9 -9
  20. package/artifacts/T.json +2 -2
  21. package/artifacts/TBTC.json +13 -13
  22. package/artifacts/TBTCToken.json +13 -13
  23. package/artifacts/TokenStaking.json +1 -1
  24. package/artifacts/TokenholderGovernor.json +9 -9
  25. package/artifacts/TokenholderTimelock.json +8 -8
  26. package/artifacts/VendingMachine.json +14 -14
  27. package/artifacts/VendingMachineKeep.json +1 -1
  28. package/artifacts/VendingMachineNuCypher.json +1 -1
  29. package/artifacts/WalletRegistry.json +2 -2
  30. package/artifacts/WalletRegistryGovernance.json +2 -2
  31. package/artifacts/Wallets.json +7 -7
  32. package/artifacts/solcInputs/{58ca6018672440f1c9c800806e096f9c.json → f49989846c3f5df5088d1ac309787c24.json} +7 -4
  33. package/build/contracts/GovernanceUtils.sol/GovernanceUtils.dbg.json +1 -1
  34. package/build/contracts/bank/Bank.sol/Bank.dbg.json +1 -1
  35. package/build/contracts/bridge/BitcoinTx.sol/BitcoinTx.dbg.json +1 -1
  36. package/build/contracts/bridge/BitcoinTx.sol/BitcoinTx.json +2 -2
  37. package/build/contracts/bridge/Bridge.sol/Bridge.dbg.json +1 -1
  38. package/build/contracts/bridge/Bridge.sol/Bridge.json +89 -67
  39. package/build/contracts/bridge/BridgeState.sol/BridgeState.dbg.json +1 -1
  40. package/build/contracts/bridge/BridgeState.sol/BridgeState.json +8 -2
  41. package/build/contracts/bridge/Deposit.sol/Deposit.dbg.json +1 -1
  42. package/build/contracts/bridge/Deposit.sol/Deposit.json +2 -2
  43. package/build/contracts/bridge/EcdsaLib.sol/EcdsaLib.dbg.json +1 -1
  44. package/build/contracts/bridge/Fraud.sol/Fraud.dbg.json +1 -1
  45. package/build/contracts/bridge/Fraud.sol/Fraud.json +2 -2
  46. package/build/contracts/bridge/IRelay.sol/IRelay.dbg.json +1 -1
  47. package/build/contracts/bridge/MovingFunds.sol/MovingFunds.dbg.json +1 -1
  48. package/build/contracts/bridge/MovingFunds.sol/MovingFunds.json +2 -2
  49. package/build/contracts/bridge/Redemption.sol/OutboundTx.dbg.json +1 -1
  50. package/build/contracts/bridge/Redemption.sol/OutboundTx.json +2 -2
  51. package/build/contracts/bridge/Redemption.sol/Redemption.dbg.json +1 -1
  52. package/build/contracts/bridge/Redemption.sol/Redemption.json +2 -2
  53. package/build/contracts/bridge/Sweep.sol/Sweep.dbg.json +1 -1
  54. package/build/contracts/bridge/Sweep.sol/Sweep.json +2 -2
  55. package/build/contracts/bridge/VendingMachine.sol/VendingMachine.dbg.json +1 -1
  56. package/build/contracts/bridge/Wallets.sol/Wallets.dbg.json +1 -1
  57. package/build/contracts/bridge/Wallets.sol/Wallets.json +2 -2
  58. package/build/contracts/token/TBTC.sol/TBTC.dbg.json +1 -1
  59. package/build/contracts/vault/IVault.sol/IVault.dbg.json +1 -1
  60. package/build/contracts/vault/TBTCVault.sol/TBTCVault.dbg.json +1 -1
  61. package/contracts/bridge/Bridge.sol +45 -12
  62. package/contracts/bridge/BridgeState.sol +22 -4
  63. package/contracts/bridge/Wallets.sol +28 -5
  64. package/deploy/07_transfer_ownership.ts +1 -3
  65. package/deploy/08_transfer_governance.ts +20 -0
  66. package/export.json +57 -35
  67. package/package.json +1 -1
@@ -105,8 +105,8 @@
105
105
  "type": "event"
106
106
  }
107
107
  ],
108
- "bytecode": "0x610fb261003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100565760003560e01c80634afbe4c91461005b57806399b0b8471461007d578063c87de7f41461009d578063d079fbb1146100bd575b600080fd5b81801561006757600080fd5b5061007b610076366004610d56565b6100dd565b005b81801561008957600080fd5b5061007b610098366004610da0565b610305565b8180156100a957600080fd5b5061007b6100b8366004610df1565b610526565b8180156100c957600080fd5b5061007b6100d8366004610e1d565b61064c565b60028401546001600160a01b0316331461014e5760405162461bcd60e51b815260206004820152602760248201527f43616c6c6572206973206e6f74207468652045434453412057616c6c657420526044820152666567697374727960c81b60648201526084015b60405180910390fd5b600061016261015d848461094b565b6109f5565b6bffffffffffffffffffffffff198116600090815260158701602052604081209192506002820154600160a01b900460ff1660058111156101a5576101a5610e4a565b146102185760405162461bcd60e51b815260206004820152602860248201527f45434453412077616c6c657420686173206265656e20616c726561647920726560448201527f67697374657265640000000000000000000000000000000000000000000000006064820152608401610145565b848155600281018054600160a01b63ffffffff42811668010000000000000000027fffffffffffffffffffffff00ffffffffffffffff00000000ffffffffffffffff90931692909217811790925560148881018054606087901c73ffffffffffffffffffffffffffffffffffffffff19909116178082559390930490911691906102a183610e76565b91906101000a81548163ffffffff021916908363ffffffff16021790555050816bffffffffffffffffffffffff1916857f2dbb47dce81d6b11cca1f1e3b10143d6f7e1e7e92d2dd9aacbb1f875379d308e60405160405180910390a3505050505050565b601483015460601b6bffffffffffffffffffffffff1990811690831614156103955760405162461bcd60e51b815260206004820152602c60248201527f4163746976652077616c6c65742063616e6e6f7420626520636f6e736964657260448201527f656420636c6f736561626c6500000000000000000000000000000000000000006064820152608401610145565b6bffffffffffffffffffffffff1982166000908152601584016020526040902060016002820154600160a01b900460ff1660058111156103d7576103d7610e4a565b1461042f5760405162461bcd60e51b815260206004820152602260248201527f45434453412077616c6c6574206d75737420626520696e204c69766520737461604482015261746560f01b6064820152608401610145565b601384015460028201546000916104639163ffffffff600160a01b9092048216916801000000000000000090910416610e9a565b63ffffffff16421015905080806104a357506013850154640100000000900467ffffffffffffffff16610497868686610a1c565b67ffffffffffffffff16105b6105155760405162461bcd60e51b815260206004820152603660248201527f57616c6c6574206e6565647320746f206265206f6c6420656e6f756768206f7260448201527f206861766520746f6f20666577207361746f73686973000000000000000000006064820152608401610145565b61051f8585610b54565b5050505050565b60028301546001600160a01b031633146105925760405162461bcd60e51b815260206004820152602760248201527f43616c6c6572206973206e6f74207468652045434453412057616c6c657420526044820152666567697374727960c81b6064820152608401610145565b60006105a161015d848461094b565b905060016bffffffffffffffffffffffff1982166000908152601586016020526040902060020154600160a01b900460ff1660058111156105e4576105e4610e4a565b1461063c5760405162461bcd60e51b815260206004820152602260248201527f45434453412077616c6c6574206d75737420626520696e204c69766520737461604482015261746560f01b6064820152608401610145565b6106468482610b54565b50505050565b6002820154604080517fcc56238800000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163cc562388916004808301926020929190829003018186803b1580156106ac57600080fd5b505afa1580156106c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106e49190610ec2565b60038111156106f5576106f5610e4a565b146107685760405162461bcd60e51b815260206004820152602360248201527f57616c6c6574206372656174696f6e20616c726561647920696e2070726f677260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610145565b601482015460601b6bffffffffffffffffffffffff198116156108b3576000610792848385610a1c565b6bffffffffffffffffffffffff1983166000908152601586016020526040812060020154601387015492935063ffffffff680100000000000000009091048116926107de911683610e9a565b63ffffffff1642101590508080156108105750601386015467ffffffffffffffff640100000000909104811690841610155b8061083d5750601386015467ffffffffffffffff6c01000000000000000000000000909104811690841610155b6108af5760405162461bcd60e51b815260206004820152602660248201527f57616c6c6574206372656174696f6e20636f6e646974696f6e7320617265206e60448201527f6f74206d657400000000000000000000000000000000000000000000000000006064820152608401610145565b5050505b6040517f31fecb80caf1e1128496dd5a6f1083ba29fd5fe64c3fe04e2d1b6f9cfc27d5a390600090a18260020160009054906101000a90046001600160a01b03166001600160a01b03166372cc8c6d6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561092e57600080fd5b505af1158015610942573d6000803e3d6000fd5b50505050505050565b6060600061095a600284610eea565b61098557507f02000000000000000000000000000000000000000000000000000000000000006109a8565b507f03000000000000000000000000000000000000000000000000000000000000005b6040517fff00000000000000000000000000000000000000000000000000000000000000821660208201526021810185905260410160405160208183030381529060405291505092915050565b60006020600083516020850160025afa50602060006020600060035afa5050600c51919050565b6bffffffffffffffffffffffff19821660009081526015840160205260408120600101548015610b4c57808335610a596040860160208701610f0c565b610a696060870160408801610f32565b604051602001610ad69392919092835260e09190911b7fffffffff0000000000000000000000000000000000000000000000000000000016602083015260c01b7fffffffffffffffff000000000000000000000000000000000000000000000000166024820152602c0190565b6040516020818303038152906040528051906020012014610b395760405162461bcd60e51b815260206004820152601d60248201527f496e76616c69642077616c6c6574206d61696e205554584f20646174610000006044820152606401610145565b610b496060840160408501610f32565b91505b509392505050565b6bffffffffffffffffffffffff198116600090815260158301602052604090206001810154610b8c57610b878383610ca8565b610c24565b60028101805463ffffffff42166c01000000000000000000000000027fffffffffffffffffffffff00ffffffff00000000ffffffffffffffffffffffff909116177402000000000000000000000000000000000000000017905580546040516bffffffffffffffffffffffff19841691907fbdc9ce990a067e5fd3a5d8dfc68e27e9f221aaa3fe55265e0b7e93c460b3efe290600090a35b601483015460601b6bffffffffffffffffffffffff199081169083161415610c665760148301805473ffffffffffffffffffffffffffffffffffffffff191690555b60148381018054600160a01b900463ffffffff1691610c8483610f5c565b91906101000a81548163ffffffff021916908363ffffffff16021790555050505050565b6bffffffffffffffffffffffff198116600081815260158401602052604080822060028101805463ffffffff4216700100000000000000000000000000000000027fffffffffffffffffffffff0000000000ffffffffffffffffffffffffffffffff9091161774030000000000000000000000000000000000000000179055805491519093927f68cb496f5e64383745876664ef119840f154a729c03ba866b8aecb5c9f53d51691a3505050565b60008060008060808587031215610d6c57600080fd5b5050823594602084013594506040840135936060013592509050565b600060608284031215610d9a57600080fd5b50919050565b600080600060a08486031215610db557600080fd5b8335925060208401356bffffffffffffffffffffffff1981168114610dd957600080fd5b9150610de88560408601610d88565b90509250925092565b600080600060608486031215610e0657600080fd5b505081359360208301359350604090920135919050565b60008060808385031215610e3057600080fd5b82359150610e418460208501610d88565b90509250929050565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600063ffffffff80831681811415610e9057610e90610e60565b6001019392505050565b600063ffffffff808316818516808303821115610eb957610eb9610e60565b01949350505050565b600060208284031215610ed457600080fd5b815160048110610ee357600080fd5b9392505050565b600082610f0757634e487b7160e01b600052601260045260246000fd5b500690565b600060208284031215610f1e57600080fd5b813563ffffffff81168114610ee357600080fd5b600060208284031215610f4457600080fd5b813567ffffffffffffffff81168114610ee357600080fd5b600063ffffffff821680610f7257610f72610e60565b600019019291505056fea2646970667358221220931dcddc50fc49ab3b0983d243a8b667e981caafadfcf67071e2da6cf01a15d164736f6c63430008090033",
109
- "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100565760003560e01c80634afbe4c91461005b57806399b0b8471461007d578063c87de7f41461009d578063d079fbb1146100bd575b600080fd5b81801561006757600080fd5b5061007b610076366004610d56565b6100dd565b005b81801561008957600080fd5b5061007b610098366004610da0565b610305565b8180156100a957600080fd5b5061007b6100b8366004610df1565b610526565b8180156100c957600080fd5b5061007b6100d8366004610e1d565b61064c565b60028401546001600160a01b0316331461014e5760405162461bcd60e51b815260206004820152602760248201527f43616c6c6572206973206e6f74207468652045434453412057616c6c657420526044820152666567697374727960c81b60648201526084015b60405180910390fd5b600061016261015d848461094b565b6109f5565b6bffffffffffffffffffffffff198116600090815260158701602052604081209192506002820154600160a01b900460ff1660058111156101a5576101a5610e4a565b146102185760405162461bcd60e51b815260206004820152602860248201527f45434453412077616c6c657420686173206265656e20616c726561647920726560448201527f67697374657265640000000000000000000000000000000000000000000000006064820152608401610145565b848155600281018054600160a01b63ffffffff42811668010000000000000000027fffffffffffffffffffffff00ffffffffffffffff00000000ffffffffffffffff90931692909217811790925560148881018054606087901c73ffffffffffffffffffffffffffffffffffffffff19909116178082559390930490911691906102a183610e76565b91906101000a81548163ffffffff021916908363ffffffff16021790555050816bffffffffffffffffffffffff1916857f2dbb47dce81d6b11cca1f1e3b10143d6f7e1e7e92d2dd9aacbb1f875379d308e60405160405180910390a3505050505050565b601483015460601b6bffffffffffffffffffffffff1990811690831614156103955760405162461bcd60e51b815260206004820152602c60248201527f4163746976652077616c6c65742063616e6e6f7420626520636f6e736964657260448201527f656420636c6f736561626c6500000000000000000000000000000000000000006064820152608401610145565b6bffffffffffffffffffffffff1982166000908152601584016020526040902060016002820154600160a01b900460ff1660058111156103d7576103d7610e4a565b1461042f5760405162461bcd60e51b815260206004820152602260248201527f45434453412077616c6c6574206d75737420626520696e204c69766520737461604482015261746560f01b6064820152608401610145565b601384015460028201546000916104639163ffffffff600160a01b9092048216916801000000000000000090910416610e9a565b63ffffffff16421015905080806104a357506013850154640100000000900467ffffffffffffffff16610497868686610a1c565b67ffffffffffffffff16105b6105155760405162461bcd60e51b815260206004820152603660248201527f57616c6c6574206e6565647320746f206265206f6c6420656e6f756768206f7260448201527f206861766520746f6f20666577207361746f73686973000000000000000000006064820152608401610145565b61051f8585610b54565b5050505050565b60028301546001600160a01b031633146105925760405162461bcd60e51b815260206004820152602760248201527f43616c6c6572206973206e6f74207468652045434453412057616c6c657420526044820152666567697374727960c81b6064820152608401610145565b60006105a161015d848461094b565b905060016bffffffffffffffffffffffff1982166000908152601586016020526040902060020154600160a01b900460ff1660058111156105e4576105e4610e4a565b1461063c5760405162461bcd60e51b815260206004820152602260248201527f45434453412077616c6c6574206d75737420626520696e204c69766520737461604482015261746560f01b6064820152608401610145565b6106468482610b54565b50505050565b6002820154604080517fcc56238800000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163cc562388916004808301926020929190829003018186803b1580156106ac57600080fd5b505afa1580156106c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106e49190610ec2565b60038111156106f5576106f5610e4a565b146107685760405162461bcd60e51b815260206004820152602360248201527f57616c6c6574206372656174696f6e20616c726561647920696e2070726f677260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610145565b601482015460601b6bffffffffffffffffffffffff198116156108b3576000610792848385610a1c565b6bffffffffffffffffffffffff1983166000908152601586016020526040812060020154601387015492935063ffffffff680100000000000000009091048116926107de911683610e9a565b63ffffffff1642101590508080156108105750601386015467ffffffffffffffff640100000000909104811690841610155b8061083d5750601386015467ffffffffffffffff6c01000000000000000000000000909104811690841610155b6108af5760405162461bcd60e51b815260206004820152602660248201527f57616c6c6574206372656174696f6e20636f6e646974696f6e7320617265206e60448201527f6f74206d657400000000000000000000000000000000000000000000000000006064820152608401610145565b5050505b6040517f31fecb80caf1e1128496dd5a6f1083ba29fd5fe64c3fe04e2d1b6f9cfc27d5a390600090a18260020160009054906101000a90046001600160a01b03166001600160a01b03166372cc8c6d6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561092e57600080fd5b505af1158015610942573d6000803e3d6000fd5b50505050505050565b6060600061095a600284610eea565b61098557507f02000000000000000000000000000000000000000000000000000000000000006109a8565b507f03000000000000000000000000000000000000000000000000000000000000005b6040517fff00000000000000000000000000000000000000000000000000000000000000821660208201526021810185905260410160405160208183030381529060405291505092915050565b60006020600083516020850160025afa50602060006020600060035afa5050600c51919050565b6bffffffffffffffffffffffff19821660009081526015840160205260408120600101548015610b4c57808335610a596040860160208701610f0c565b610a696060870160408801610f32565b604051602001610ad69392919092835260e09190911b7fffffffff0000000000000000000000000000000000000000000000000000000016602083015260c01b7fffffffffffffffff000000000000000000000000000000000000000000000000166024820152602c0190565b6040516020818303038152906040528051906020012014610b395760405162461bcd60e51b815260206004820152601d60248201527f496e76616c69642077616c6c6574206d61696e205554584f20646174610000006044820152606401610145565b610b496060840160408501610f32565b91505b509392505050565b6bffffffffffffffffffffffff198116600090815260158301602052604090206001810154610b8c57610b878383610ca8565b610c24565b60028101805463ffffffff42166c01000000000000000000000000027fffffffffffffffffffffff00ffffffff00000000ffffffffffffffffffffffff909116177402000000000000000000000000000000000000000017905580546040516bffffffffffffffffffffffff19841691907fbdc9ce990a067e5fd3a5d8dfc68e27e9f221aaa3fe55265e0b7e93c460b3efe290600090a35b601483015460601b6bffffffffffffffffffffffff199081169083161415610c665760148301805473ffffffffffffffffffffffffffffffffffffffff191690555b60148381018054600160a01b900463ffffffff1691610c8483610f5c565b91906101000a81548163ffffffff021916908363ffffffff16021790555050505050565b6bffffffffffffffffffffffff198116600081815260158401602052604080822060028101805463ffffffff4216700100000000000000000000000000000000027fffffffffffffffffffffff0000000000ffffffffffffffffffffffffffffffff9091161774030000000000000000000000000000000000000000179055805491519093927f68cb496f5e64383745876664ef119840f154a729c03ba866b8aecb5c9f53d51691a3505050565b60008060008060808587031215610d6c57600080fd5b5050823594602084013594506040840135936060013592509050565b600060608284031215610d9a57600080fd5b50919050565b600080600060a08486031215610db557600080fd5b8335925060208401356bffffffffffffffffffffffff1981168114610dd957600080fd5b9150610de88560408601610d88565b90509250925092565b600080600060608486031215610e0657600080fd5b505081359360208301359350604090920135919050565b60008060808385031215610e3057600080fd5b82359150610e418460208501610d88565b90509250929050565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600063ffffffff80831681811415610e9057610e90610e60565b6001019392505050565b600063ffffffff808316818516808303821115610eb957610eb9610e60565b01949350505050565b600060208284031215610ed457600080fd5b815160048110610ee357600080fd5b9392505050565b600082610f0757634e487b7160e01b600052601260045260246000fd5b500690565b600060208284031215610f1e57600080fd5b813563ffffffff81168114610ee357600080fd5b600060208284031215610f4457600080fd5b813567ffffffffffffffff81168114610ee357600080fd5b600063ffffffff821680610f7257610f72610e60565b600019019291505056fea2646970667358221220931dcddc50fc49ab3b0983d243a8b667e981caafadfcf67071e2da6cf01a15d164736f6c63430008090033",
108
+ "bytecode": "0x610fb261003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100565760003560e01c80634afbe4c91461005b57806399b0b8471461007d578063c87de7f41461009d578063d079fbb1146100bd575b600080fd5b81801561006757600080fd5b5061007b610076366004610d56565b6100dd565b005b81801561008957600080fd5b5061007b610098366004610da0565b610305565b8180156100a957600080fd5b5061007b6100b8366004610df1565b610526565b8180156100c957600080fd5b5061007b6100d8366004610e1d565b61064c565b60028401546001600160a01b0316331461014e5760405162461bcd60e51b815260206004820152602760248201527f43616c6c6572206973206e6f74207468652045434453412057616c6c657420526044820152666567697374727960c81b60648201526084015b60405180910390fd5b600061016261015d848461094b565b6109f5565b6bffffffffffffffffffffffff198116600090815260168701602052604081209192506002820154600160a01b900460ff1660058111156101a5576101a5610e4a565b146102185760405162461bcd60e51b815260206004820152602860248201527f45434453412077616c6c657420686173206265656e20616c726561647920726560448201527f67697374657265640000000000000000000000000000000000000000000000006064820152608401610145565b848155600281018054600160a01b63ffffffff42811668010000000000000000027fffffffffffffffffffffff00ffffffffffffffff00000000ffffffffffffffff90931692909217811790925560148881018054606087901c73ffffffffffffffffffffffffffffffffffffffff19909116178082559390930490911691906102a183610e76565b91906101000a81548163ffffffff021916908363ffffffff16021790555050816bffffffffffffffffffffffff1916857f2dbb47dce81d6b11cca1f1e3b10143d6f7e1e7e92d2dd9aacbb1f875379d308e60405160405180910390a3505050505050565b601483015460601b6bffffffffffffffffffffffff1990811690831614156103955760405162461bcd60e51b815260206004820152602c60248201527f4163746976652077616c6c65742063616e6e6f7420626520636f6e736964657260448201527f656420636c6f736561626c6500000000000000000000000000000000000000006064820152608401610145565b6bffffffffffffffffffffffff1982166000908152601684016020526040902060016002820154600160a01b900460ff1660058111156103d7576103d7610e4a565b1461042f5760405162461bcd60e51b815260206004820152602260248201527f45434453412077616c6c6574206d75737420626520696e204c69766520737461604482015261746560f01b6064820152608401610145565b601384015460028201546000916104639163ffffffff600160a01b9092048216916801000000000000000090910416610e9a565b63ffffffff16421015905080806104a357506013850154640100000000900467ffffffffffffffff16610497868686610a1c565b67ffffffffffffffff16105b6105155760405162461bcd60e51b815260206004820152603660248201527f57616c6c6574206e6565647320746f206265206f6c6420656e6f756768206f7260448201527f206861766520746f6f20666577207361746f73686973000000000000000000006064820152608401610145565b61051f8585610b54565b5050505050565b60028301546001600160a01b031633146105925760405162461bcd60e51b815260206004820152602760248201527f43616c6c6572206973206e6f74207468652045434453412057616c6c657420526044820152666567697374727960c81b6064820152608401610145565b60006105a161015d848461094b565b905060016bffffffffffffffffffffffff1982166000908152601686016020526040902060020154600160a01b900460ff1660058111156105e4576105e4610e4a565b1461063c5760405162461bcd60e51b815260206004820152602260248201527f45434453412077616c6c6574206d75737420626520696e204c69766520737461604482015261746560f01b6064820152608401610145565b6106468482610b54565b50505050565b6002820154604080517fcc56238800000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163cc562388916004808301926020929190829003018186803b1580156106ac57600080fd5b505afa1580156106c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106e49190610ec2565b60038111156106f5576106f5610e4a565b146107685760405162461bcd60e51b815260206004820152602360248201527f57616c6c6574206372656174696f6e20616c726561647920696e2070726f677260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610145565b601482015460601b6bffffffffffffffffffffffff198116156108b3576000610792848385610a1c565b6bffffffffffffffffffffffff1983166000908152601686016020526040812060020154601387015492935063ffffffff680100000000000000009091048116926107de911683610e9a565b63ffffffff1642101590508080156108105750601386015467ffffffffffffffff640100000000909104811690841610155b8061083d5750601386015467ffffffffffffffff6c01000000000000000000000000909104811690841610155b6108af5760405162461bcd60e51b815260206004820152602660248201527f57616c6c6574206372656174696f6e20636f6e646974696f6e7320617265206e60448201527f6f74206d657400000000000000000000000000000000000000000000000000006064820152608401610145565b5050505b6040517f31fecb80caf1e1128496dd5a6f1083ba29fd5fe64c3fe04e2d1b6f9cfc27d5a390600090a18260020160009054906101000a90046001600160a01b03166001600160a01b03166372cc8c6d6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561092e57600080fd5b505af1158015610942573d6000803e3d6000fd5b50505050505050565b6060600061095a600284610eea565b61098557507f02000000000000000000000000000000000000000000000000000000000000006109a8565b507f03000000000000000000000000000000000000000000000000000000000000005b6040517fff00000000000000000000000000000000000000000000000000000000000000821660208201526021810185905260410160405160208183030381529060405291505092915050565b60006020600083516020850160025afa50602060006020600060035afa5050600c51919050565b6bffffffffffffffffffffffff19821660009081526016840160205260408120600101548015610b4c57808335610a596040860160208701610f0c565b610a696060870160408801610f32565b604051602001610ad69392919092835260e09190911b7fffffffff0000000000000000000000000000000000000000000000000000000016602083015260c01b7fffffffffffffffff000000000000000000000000000000000000000000000000166024820152602c0190565b6040516020818303038152906040528051906020012014610b395760405162461bcd60e51b815260206004820152601d60248201527f496e76616c69642077616c6c6574206d61696e205554584f20646174610000006044820152606401610145565b610b496060840160408501610f32565b91505b509392505050565b6bffffffffffffffffffffffff198116600090815260168301602052604090206001810154610b8c57610b878383610ca8565b610c24565b60028101805463ffffffff42166c01000000000000000000000000027fffffffffffffffffffffff00ffffffff00000000ffffffffffffffffffffffff909116177402000000000000000000000000000000000000000017905580546040516bffffffffffffffffffffffff19841691907fbdc9ce990a067e5fd3a5d8dfc68e27e9f221aaa3fe55265e0b7e93c460b3efe290600090a35b601483015460601b6bffffffffffffffffffffffff199081169083161415610c665760148301805473ffffffffffffffffffffffffffffffffffffffff191690555b60148381018054600160a01b900463ffffffff1691610c8483610f5c565b91906101000a81548163ffffffff021916908363ffffffff16021790555050505050565b6bffffffffffffffffffffffff198116600081815260168401602052604080822060028101805463ffffffff4216700100000000000000000000000000000000027fffffffffffffffffffffff0000000000ffffffffffffffffffffffffffffffff9091161774030000000000000000000000000000000000000000179055805491519093927f68cb496f5e64383745876664ef119840f154a729c03ba866b8aecb5c9f53d51691a3505050565b60008060008060808587031215610d6c57600080fd5b5050823594602084013594506040840135936060013592509050565b600060608284031215610d9a57600080fd5b50919050565b600080600060a08486031215610db557600080fd5b8335925060208401356bffffffffffffffffffffffff1981168114610dd957600080fd5b9150610de88560408601610d88565b90509250925092565b600080600060608486031215610e0657600080fd5b505081359360208301359350604090920135919050565b60008060808385031215610e3057600080fd5b82359150610e418460208501610d88565b90509250929050565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600063ffffffff80831681811415610e9057610e90610e60565b6001019392505050565b600063ffffffff808316818516808303821115610eb957610eb9610e60565b01949350505050565b600060208284031215610ed457600080fd5b815160048110610ee357600080fd5b9392505050565b600082610f0757634e487b7160e01b600052601260045260246000fd5b500690565b600060208284031215610f1e57600080fd5b813563ffffffff81168114610ee357600080fd5b600060208284031215610f4457600080fd5b813567ffffffffffffffff81168114610ee357600080fd5b600063ffffffff821680610f7257610f72610e60565b600019019291505056fea264697066735822122017aeeb2a3ab4dc17f34c716ba3f7077d4cd4f099d76fb527459453add3950cfa64736f6c63430008090033",
109
+ "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100565760003560e01c80634afbe4c91461005b57806399b0b8471461007d578063c87de7f41461009d578063d079fbb1146100bd575b600080fd5b81801561006757600080fd5b5061007b610076366004610d56565b6100dd565b005b81801561008957600080fd5b5061007b610098366004610da0565b610305565b8180156100a957600080fd5b5061007b6100b8366004610df1565b610526565b8180156100c957600080fd5b5061007b6100d8366004610e1d565b61064c565b60028401546001600160a01b0316331461014e5760405162461bcd60e51b815260206004820152602760248201527f43616c6c6572206973206e6f74207468652045434453412057616c6c657420526044820152666567697374727960c81b60648201526084015b60405180910390fd5b600061016261015d848461094b565b6109f5565b6bffffffffffffffffffffffff198116600090815260168701602052604081209192506002820154600160a01b900460ff1660058111156101a5576101a5610e4a565b146102185760405162461bcd60e51b815260206004820152602860248201527f45434453412077616c6c657420686173206265656e20616c726561647920726560448201527f67697374657265640000000000000000000000000000000000000000000000006064820152608401610145565b848155600281018054600160a01b63ffffffff42811668010000000000000000027fffffffffffffffffffffff00ffffffffffffffff00000000ffffffffffffffff90931692909217811790925560148881018054606087901c73ffffffffffffffffffffffffffffffffffffffff19909116178082559390930490911691906102a183610e76565b91906101000a81548163ffffffff021916908363ffffffff16021790555050816bffffffffffffffffffffffff1916857f2dbb47dce81d6b11cca1f1e3b10143d6f7e1e7e92d2dd9aacbb1f875379d308e60405160405180910390a3505050505050565b601483015460601b6bffffffffffffffffffffffff1990811690831614156103955760405162461bcd60e51b815260206004820152602c60248201527f4163746976652077616c6c65742063616e6e6f7420626520636f6e736964657260448201527f656420636c6f736561626c6500000000000000000000000000000000000000006064820152608401610145565b6bffffffffffffffffffffffff1982166000908152601684016020526040902060016002820154600160a01b900460ff1660058111156103d7576103d7610e4a565b1461042f5760405162461bcd60e51b815260206004820152602260248201527f45434453412077616c6c6574206d75737420626520696e204c69766520737461604482015261746560f01b6064820152608401610145565b601384015460028201546000916104639163ffffffff600160a01b9092048216916801000000000000000090910416610e9a565b63ffffffff16421015905080806104a357506013850154640100000000900467ffffffffffffffff16610497868686610a1c565b67ffffffffffffffff16105b6105155760405162461bcd60e51b815260206004820152603660248201527f57616c6c6574206e6565647320746f206265206f6c6420656e6f756768206f7260448201527f206861766520746f6f20666577207361746f73686973000000000000000000006064820152608401610145565b61051f8585610b54565b5050505050565b60028301546001600160a01b031633146105925760405162461bcd60e51b815260206004820152602760248201527f43616c6c6572206973206e6f74207468652045434453412057616c6c657420526044820152666567697374727960c81b6064820152608401610145565b60006105a161015d848461094b565b905060016bffffffffffffffffffffffff1982166000908152601686016020526040902060020154600160a01b900460ff1660058111156105e4576105e4610e4a565b1461063c5760405162461bcd60e51b815260206004820152602260248201527f45434453412077616c6c6574206d75737420626520696e204c69766520737461604482015261746560f01b6064820152608401610145565b6106468482610b54565b50505050565b6002820154604080517fcc56238800000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163cc562388916004808301926020929190829003018186803b1580156106ac57600080fd5b505afa1580156106c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106e49190610ec2565b60038111156106f5576106f5610e4a565b146107685760405162461bcd60e51b815260206004820152602360248201527f57616c6c6574206372656174696f6e20616c726561647920696e2070726f677260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610145565b601482015460601b6bffffffffffffffffffffffff198116156108b3576000610792848385610a1c565b6bffffffffffffffffffffffff1983166000908152601686016020526040812060020154601387015492935063ffffffff680100000000000000009091048116926107de911683610e9a565b63ffffffff1642101590508080156108105750601386015467ffffffffffffffff640100000000909104811690841610155b8061083d5750601386015467ffffffffffffffff6c01000000000000000000000000909104811690841610155b6108af5760405162461bcd60e51b815260206004820152602660248201527f57616c6c6574206372656174696f6e20636f6e646974696f6e7320617265206e60448201527f6f74206d657400000000000000000000000000000000000000000000000000006064820152608401610145565b5050505b6040517f31fecb80caf1e1128496dd5a6f1083ba29fd5fe64c3fe04e2d1b6f9cfc27d5a390600090a18260020160009054906101000a90046001600160a01b03166001600160a01b03166372cc8c6d6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561092e57600080fd5b505af1158015610942573d6000803e3d6000fd5b50505050505050565b6060600061095a600284610eea565b61098557507f02000000000000000000000000000000000000000000000000000000000000006109a8565b507f03000000000000000000000000000000000000000000000000000000000000005b6040517fff00000000000000000000000000000000000000000000000000000000000000821660208201526021810185905260410160405160208183030381529060405291505092915050565b60006020600083516020850160025afa50602060006020600060035afa5050600c51919050565b6bffffffffffffffffffffffff19821660009081526016840160205260408120600101548015610b4c57808335610a596040860160208701610f0c565b610a696060870160408801610f32565b604051602001610ad69392919092835260e09190911b7fffffffff0000000000000000000000000000000000000000000000000000000016602083015260c01b7fffffffffffffffff000000000000000000000000000000000000000000000000166024820152602c0190565b6040516020818303038152906040528051906020012014610b395760405162461bcd60e51b815260206004820152601d60248201527f496e76616c69642077616c6c6574206d61696e205554584f20646174610000006044820152606401610145565b610b496060840160408501610f32565b91505b509392505050565b6bffffffffffffffffffffffff198116600090815260168301602052604090206001810154610b8c57610b878383610ca8565b610c24565b60028101805463ffffffff42166c01000000000000000000000000027fffffffffffffffffffffff00ffffffff00000000ffffffffffffffffffffffff909116177402000000000000000000000000000000000000000017905580546040516bffffffffffffffffffffffff19841691907fbdc9ce990a067e5fd3a5d8dfc68e27e9f221aaa3fe55265e0b7e93c460b3efe290600090a35b601483015460601b6bffffffffffffffffffffffff199081169083161415610c665760148301805473ffffffffffffffffffffffffffffffffffffffff191690555b60148381018054600160a01b900463ffffffff1691610c8483610f5c565b91906101000a81548163ffffffff021916908363ffffffff16021790555050505050565b6bffffffffffffffffffffffff198116600081815260168401602052604080822060028101805463ffffffff4216700100000000000000000000000000000000027fffffffffffffffffffffff0000000000ffffffffffffffffffffffffffffffff9091161774030000000000000000000000000000000000000000179055805491519093927f68cb496f5e64383745876664ef119840f154a729c03ba866b8aecb5c9f53d51691a3505050565b60008060008060808587031215610d6c57600080fd5b5050823594602084013594506040840135936060013592509050565b600060608284031215610d9a57600080fd5b50919050565b600080600060a08486031215610db557600080fd5b8335925060208401356bffffffffffffffffffffffff1981168114610dd957600080fd5b9150610de88560408601610d88565b90509250925092565b600080600060608486031215610e0657600080fd5b505081359360208301359350604090920135919050565b60008060808385031215610e3057600080fd5b82359150610e418460208501610d88565b90509250929050565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600063ffffffff80831681811415610e9057610e90610e60565b6001019392505050565b600063ffffffff808316818516808303821115610eb957610eb9610e60565b01949350505050565b600060208284031215610ed457600080fd5b815160048110610ee357600080fd5b9392505050565b600082610f0757634e487b7160e01b600052601260045260246000fd5b500690565b600060208284031215610f1e57600080fd5b813563ffffffff81168114610ee357600080fd5b600060208284031215610f4457600080fd5b813567ffffffffffffffff81168114610ee357600080fd5b600063ffffffff821680610f7257610f72610e60565b600019019291505056fea264697066735822122017aeeb2a3ab4dc17f34c716ba3f7077d4cd4f099d76fb527459453add3950cfa64736f6c63430008090033",
110
110
  "linkReferences": {},
111
111
  "deployedLinkReferences": {}
112
112
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/4f9d359aa21e83b5618a39471fb80624.json"
3
+ "buildInfo": "../../../build-info/e0806ace078684e867209437e69b8816.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/4f9d359aa21e83b5618a39471fb80624.json"
3
+ "buildInfo": "../../../build-info/e0806ace078684e867209437e69b8816.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/4f9d359aa21e83b5618a39471fb80624.json"
3
+ "buildInfo": "../../../build-info/e0806ace078684e867209437e69b8816.json"
4
4
  }
@@ -15,7 +15,7 @@
15
15
 
16
16
  pragma solidity ^0.8.9;
17
17
 
18
- import "@openzeppelin/contracts/access/Ownable.sol";
18
+ import "@keep-network/random-beacon/contracts/Governable.sol";
19
19
 
20
20
  import {IWalletOwner as EcdsaWalletOwner} from "@keep-network/ecdsa/contracts/api/IWalletOwner.sol";
21
21
 
@@ -57,7 +57,7 @@ import "../bank/Bank.sol";
57
57
  /// TODO: Revisit all events and look which parameters should be indexed.
58
58
  /// TODO: Align the convention around `param` and `dev` endings. They should
59
59
  /// not have a punctuation mark.
60
- contract Bridge is Ownable, EcdsaWalletOwner {
60
+ contract Bridge is Governable, EcdsaWalletOwner {
61
61
  using BridgeState for BridgeState.Storage;
62
62
  using Deposit for BridgeState.Storage;
63
63
  using Sweep for BridgeState.Storage;
@@ -181,7 +181,8 @@ contract Bridge is Ownable, EcdsaWalletOwner {
181
181
  uint64 walletMinBtcBalance,
182
182
  uint64 walletMaxBtcBalance,
183
183
  uint32 walletMaxAge,
184
- uint64 walletMaxBtcTransfer
184
+ uint64 walletMaxBtcTransfer,
185
+ uint32 walletClosingPeriod
185
186
  );
186
187
 
187
188
  event FraudParametersUpdated(
@@ -234,6 +235,9 @@ contract Bridge is Ownable, EcdsaWalletOwner {
234
235
  self.walletMaxBtcBalance = 10e8; // 10 BTC
235
236
  self.walletMaxAge = 26 weeks; // ~6 months
236
237
  self.walletMaxBtcTransfer = 10e8; // 10 BTC
238
+ self.walletClosingPeriod = 40 days;
239
+
240
+ _transferGovernance(msg.sender);
237
241
  }
238
242
 
239
243
  /// @notice Used by the depositor to reveal information about their P2(W)SH
@@ -656,6 +660,19 @@ contract Bridge is Ownable, EcdsaWalletOwner {
656
660
  self.notifyCloseableWallet(walletPubKeyHash, walletMainUtxo);
657
661
  }
658
662
 
663
+ /// @notice Notifies about the end of the closing period for the given wallet.
664
+ /// Closes the wallet ultimately and notifies the ECDSA registry
665
+ /// about this fact.
666
+ /// @param walletPubKeyHash 20-byte public key hash of the wallet
667
+ /// @dev Requirements:
668
+ /// - The wallet must be in the Closing state
669
+ /// - The wallet closing period must have elapsed
670
+ function notifyWalletClosingPeriodElapsed(bytes20 walletPubKeyHash)
671
+ external
672
+ {
673
+ self.notifyWalletClosingPeriodElapsed(walletPubKeyHash);
674
+ }
675
+
659
676
  /// @notice Submits a fraud challenge indicating that a UTXO being under
660
677
  /// wallet control was unlocked by the wallet but was not used
661
678
  /// according to the protocol rules. That means the wallet signed
@@ -775,7 +792,10 @@ contract Bridge is Ownable, EcdsaWalletOwner {
775
792
  /// @param vault The address of the vault
776
793
  /// @param isTrusted flag indicating whether the vault is trusted or not
777
794
  /// @dev Can only be called by the Governance.
778
- function setVaultStatus(address vault, bool isTrusted) external onlyOwner {
795
+ function setVaultStatus(address vault, bool isTrusted)
796
+ external
797
+ onlyGovernance
798
+ {
779
799
  self.isVaultTrusted[vault] = isTrusted;
780
800
  emit VaultStatusUpdated(vault, isTrusted);
781
801
  }
@@ -808,7 +828,7 @@ contract Bridge is Ownable, EcdsaWalletOwner {
808
828
  uint64 depositDustThreshold,
809
829
  uint64 depositTreasuryFeeDivisor,
810
830
  uint64 depositTxMaxFee
811
- ) external onlyOwner {
831
+ ) external onlyGovernance {
812
832
  self.updateDepositParameters(
813
833
  depositDustThreshold,
814
834
  depositTreasuryFeeDivisor,
@@ -856,7 +876,7 @@ contract Bridge is Ownable, EcdsaWalletOwner {
856
876
  uint64 redemptionTreasuryFeeDivisor,
857
877
  uint64 redemptionTxMaxFee,
858
878
  uint256 redemptionTimeout
859
- ) external onlyOwner {
879
+ ) external onlyGovernance {
860
880
  self.updateRedemptionParameters(
861
881
  redemptionDustThreshold,
862
882
  redemptionTreasuryFeeDivisor,
@@ -882,7 +902,7 @@ contract Bridge is Ownable, EcdsaWalletOwner {
882
902
  function updateMovingFundsParameters(
883
903
  uint64 movingFundsTxMaxTotalFee,
884
904
  uint32 movingFundsTimeout
885
- ) external onlyOwner {
905
+ ) external onlyGovernance {
886
906
  self.updateMovingFundsParameters(
887
907
  movingFundsTxMaxTotalFee,
888
908
  movingFundsTimeout
@@ -903,24 +923,31 @@ contract Bridge is Ownable, EcdsaWalletOwner {
903
923
  /// @param walletMaxBtcTransfer New value of the wallet maximum BTC transfer
904
924
  /// in satoshi, determines the maximum amount that can be transferred
905
925
  // to a single target wallet during the moving funds process
926
+ /// @param walletClosingPeriod New value of the wallet closing period in
927
+ /// seconds, determines the length of the wallet closing period,
928
+ // i.e. the period when the wallet remains in the Closing state
929
+ // and can be subject of deposit fraud challenges
906
930
  /// @dev Requirements:
907
931
  /// - Wallet minimum BTC balance must be greater than zero
908
932
  /// - Wallet maximum BTC balance must be greater than the wallet
909
933
  /// minimum BTC balance
910
934
  /// - Wallet maximum BTC transfer must be greater than zero
935
+ /// - Wallet closing period must be greater than zero
911
936
  function updateWalletParameters(
912
937
  uint32 walletCreationPeriod,
913
938
  uint64 walletMinBtcBalance,
914
939
  uint64 walletMaxBtcBalance,
915
940
  uint32 walletMaxAge,
916
- uint64 walletMaxBtcTransfer
917
- ) external onlyOwner {
941
+ uint64 walletMaxBtcTransfer,
942
+ uint32 walletClosingPeriod
943
+ ) external onlyGovernance {
918
944
  self.updateWalletParameters(
919
945
  walletCreationPeriod,
920
946
  walletMinBtcBalance,
921
947
  walletMaxBtcBalance,
922
948
  walletMaxAge,
923
- walletMaxBtcTransfer
949
+ walletMaxBtcTransfer,
950
+ walletClosingPeriod
924
951
  );
925
952
  }
926
953
 
@@ -946,7 +973,7 @@ contract Bridge is Ownable, EcdsaWalletOwner {
946
973
  uint256 fraudNotifierRewardMultiplier,
947
974
  uint256 fraudChallengeDefeatTimeout,
948
975
  uint256 fraudChallengeDepositAmount
949
- ) external onlyOwner {
976
+ ) external onlyGovernance {
950
977
  self.updateFraudParameters(
951
978
  fraudSlashingAmount,
952
979
  fraudNotifierRewardMultiplier,
@@ -1171,6 +1198,10 @@ contract Bridge is Ownable, EcdsaWalletOwner {
1171
1198
  /// @return walletMaxBtcTransfer The maximum BTC amount in satoshi than
1172
1199
  /// can be transferred to a single target wallet during the moving
1173
1200
  /// funds process.
1201
+ /// @return walletClosingPeriod Determines the length of the wallet closing
1202
+ /// period, i.e. the period when the wallet remains in the Closing
1203
+ /// state and can be subject of deposit fraud challenges. Value
1204
+ /// in seconds.
1174
1205
  function walletParameters()
1175
1206
  external
1176
1207
  view
@@ -1179,7 +1210,8 @@ contract Bridge is Ownable, EcdsaWalletOwner {
1179
1210
  uint64 walletMinBtcBalance,
1180
1211
  uint64 walletMaxBtcBalance,
1181
1212
  uint32 walletMaxAge,
1182
- uint64 walletMaxBtcTransfer
1213
+ uint64 walletMaxBtcTransfer,
1214
+ uint32 walletClosingPeriod
1183
1215
  )
1184
1216
  {
1185
1217
  walletCreationPeriod = self.walletCreationPeriod;
@@ -1187,6 +1219,7 @@ contract Bridge is Ownable, EcdsaWalletOwner {
1187
1219
  walletMaxBtcBalance = self.walletMaxBtcBalance;
1188
1220
  walletMaxAge = self.walletMaxAge;
1189
1221
  walletMaxBtcTransfer = self.walletMaxBtcTransfer;
1222
+ walletClosingPeriod = self.walletClosingPeriod;
1190
1223
  }
1191
1224
 
1192
1225
  /// @notice Returns the current values of Bridge fraud parameters.
@@ -186,6 +186,11 @@ library BridgeState {
186
186
  // The maximum BTC amount in satoshi than can be transferred to a single
187
187
  // target wallet during the moving funds process.
188
188
  uint64 walletMaxBtcTransfer;
189
+ // Determines the length of the wallet closing period, i.e. the period
190
+ // when the wallet remains in the Closing state and can be subject
191
+ // of deposit fraud challenges. This value is in seconds and should be
192
+ // greater than the deposit refund time plus some time margin.
193
+ uint32 walletClosingPeriod;
189
194
  // Maps the 20-byte wallet public key hash (computed using Bitcoin
190
195
  // HASH160 over the compressed ECDSA public key) to the basic wallet
191
196
  // information like state and pending redemptions value.
@@ -215,7 +220,8 @@ library BridgeState {
215
220
  uint64 walletMinBtcBalance,
216
221
  uint64 walletMaxBtcBalance,
217
222
  uint32 walletMaxAge,
218
- uint64 walletMaxBtcTransfer
223
+ uint64 walletMaxBtcTransfer,
224
+ uint32 walletClosingPeriod
219
225
  );
220
226
 
221
227
  event FraudParametersUpdated(
@@ -407,19 +413,25 @@ library BridgeState {
407
413
  /// the wallet moving funds process can be requested
408
414
  /// @param _walletMaxBtcTransfer New value of the wallet maximum BTC transfer
409
415
  /// in satoshi, determines the maximum amount that can be transferred
410
- // to a single target wallet during the moving funds process
416
+ /// to a single target wallet during the moving funds process
417
+ /// @param _walletClosingPeriod New value of the wallet closing period in
418
+ /// seconds, determines the length of the wallet closing period,
419
+ // i.e. the period when the wallet remains in the Closing state
420
+ // and can be subject of deposit fraud challenges
411
421
  /// @dev Requirements:
412
422
  /// - Wallet minimum BTC balance must be greater than zero
413
423
  /// - Wallet maximum BTC balance must be greater than the wallet
414
424
  /// minimum BTC balance
415
425
  /// - Wallet maximum BTC transfer must be greater than zero
426
+ /// - Wallet closing period must be greater than zero
416
427
  function updateWalletParameters(
417
428
  Storage storage self,
418
429
  uint32 _walletCreationPeriod,
419
430
  uint64 _walletMinBtcBalance,
420
431
  uint64 _walletMaxBtcBalance,
421
432
  uint32 _walletMaxAge,
422
- uint64 _walletMaxBtcTransfer
433
+ uint64 _walletMaxBtcTransfer,
434
+ uint32 _walletClosingPeriod
423
435
  ) internal {
424
436
  require(
425
437
  _walletMinBtcBalance > 0,
@@ -433,19 +445,25 @@ library BridgeState {
433
445
  _walletMaxBtcTransfer > 0,
434
446
  "Wallet maximum BTC transfer must be greater than zero"
435
447
  );
448
+ require(
449
+ _walletClosingPeriod > 0,
450
+ "Wallet closing period must be greater than zero"
451
+ );
436
452
 
437
453
  self.walletCreationPeriod = _walletCreationPeriod;
438
454
  self.walletMinBtcBalance = _walletMinBtcBalance;
439
455
  self.walletMaxBtcBalance = _walletMaxBtcBalance;
440
456
  self.walletMaxAge = _walletMaxAge;
441
457
  self.walletMaxBtcTransfer = _walletMaxBtcTransfer;
458
+ self.walletClosingPeriod = _walletClosingPeriod;
442
459
 
443
460
  emit WalletParametersUpdated(
444
461
  _walletCreationPeriod,
445
462
  _walletMinBtcBalance,
446
463
  _walletMaxBtcBalance,
447
464
  _walletMaxAge,
448
- _walletMaxBtcTransfer
465
+ _walletMaxBtcTransfer,
466
+ _walletClosingPeriod
449
467
  );
450
468
  }
451
469
 
@@ -418,16 +418,39 @@ library Wallets {
418
418
  emit WalletClosing(wallet.ecdsaWalletID, walletPubKeyHash);
419
419
  }
420
420
 
421
+ /// @notice Notifies about the end of the closing period for the given wallet.
422
+ /// Closes the wallet ultimately and notifies the ECDSA registry
423
+ /// about this fact.
424
+ /// @param walletPubKeyHash 20-byte public key hash of the wallet
425
+ /// @dev Requirements:
426
+ /// - The wallet must be in the Closing state
427
+ /// - The wallet closing period must have elapsed
428
+ function notifyWalletClosingPeriodElapsed(
429
+ BridgeState.Storage storage self,
430
+ bytes20 walletPubKeyHash
431
+ ) internal {
432
+ Wallet storage wallet = self.registeredWallets[walletPubKeyHash];
433
+
434
+ require(
435
+ wallet.state == WalletState.Closing,
436
+ "ECDSA wallet must be in Closing state"
437
+ );
438
+
439
+ require(
440
+ /* solhint-disable-next-line not-rely-on-time */
441
+ block.timestamp >
442
+ wallet.closingStartedAt + self.walletClosingPeriod,
443
+ "Closing period has not elapsed yet"
444
+ );
445
+
446
+ finalizeWalletClosing(self, walletPubKeyHash);
447
+ }
448
+
421
449
  /// @notice Finalizes the closing period of the given wallet and notifies
422
450
  /// the ECDSA registry about this fact.
423
451
  /// @param walletPubKeyHash 20-byte public key hash of the wallet
424
452
  /// @dev Requirements:
425
453
  /// - The caller must make sure that the wallet is in the Closing state
426
- ///
427
- /// TODO: Make this function callable from the Bridge contract if
428
- /// `block.timestamp > wallet.closingStartedAt + self.walletClosingPeriod`.
429
- ///
430
- // slither-disable-next-line dead-code
431
454
  function finalizeWalletClosing(
432
455
  BridgeState.Storage storage self,
433
456
  bytes20 walletPubKeyHash
@@ -6,12 +6,10 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
6
6
  const { deployer, governance } = await getNamedAccounts()
7
7
 
8
8
  await helpers.ownable.transferOwnership("Bank", governance, deployer)
9
-
10
- await helpers.ownable.transferOwnership("Bridge", governance, deployer)
11
9
  }
12
10
 
13
11
  export default func
14
12
 
15
13
  func.tags = ["TransferOwnership"]
16
- func.dependencies = ["Bank", "Bridge"]
14
+ func.dependencies = ["Bank"]
17
15
  func.runAtTheEnd = true
@@ -0,0 +1,20 @@
1
+ import { HardhatRuntimeEnvironment } from "hardhat/types"
2
+ import { DeployFunction } from "hardhat-deploy/types"
3
+
4
+ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
5
+ const { getNamedAccounts, deployments } = hre
6
+ const { deployer, governance } = await getNamedAccounts()
7
+
8
+ await deployments.execute(
9
+ "Bridge",
10
+ { from: deployer },
11
+ "transferGovernance",
12
+ governance
13
+ )
14
+ }
15
+
16
+ export default func
17
+
18
+ func.tags = ["TransferGovernance"]
19
+ func.dependencies = ["Bridge"]
20
+ func.runAtTheEnd = true
package/export.json CHANGED
@@ -14209,6 +14209,25 @@
14209
14209
  "name": "FraudParametersUpdated",
14210
14210
  "type": "event"
14211
14211
  },
14212
+ {
14213
+ "anonymous": false,
14214
+ "inputs": [
14215
+ {
14216
+ "indexed": false,
14217
+ "internalType": "address",
14218
+ "name": "oldGovernance",
14219
+ "type": "address"
14220
+ },
14221
+ {
14222
+ "indexed": false,
14223
+ "internalType": "address",
14224
+ "name": "newGovernance",
14225
+ "type": "address"
14226
+ }
14227
+ ],
14228
+ "name": "GovernanceTransferred",
14229
+ "type": "event"
14230
+ },
14212
14231
  {
14213
14232
  "anonymous": false,
14214
14233
  "inputs": [
@@ -14310,25 +14329,6 @@
14310
14329
  "name": "NewWalletRequested",
14311
14330
  "type": "event"
14312
14331
  },
14313
- {
14314
- "anonymous": false,
14315
- "inputs": [
14316
- {
14317
- "indexed": true,
14318
- "internalType": "address",
14319
- "name": "previousOwner",
14320
- "type": "address"
14321
- },
14322
- {
14323
- "indexed": true,
14324
- "internalType": "address",
14325
- "name": "newOwner",
14326
- "type": "address"
14327
- }
14328
- ],
14329
- "name": "OwnershipTransferred",
14330
- "type": "event"
14331
- },
14332
14332
  {
14333
14333
  "anonymous": false,
14334
14334
  "inputs": [
@@ -14549,6 +14549,12 @@
14549
14549
  "internalType": "uint64",
14550
14550
  "name": "walletMaxBtcTransfer",
14551
14551
  "type": "uint64"
14552
+ },
14553
+ {
14554
+ "indexed": false,
14555
+ "internalType": "uint32",
14556
+ "name": "walletClosingPeriod",
14557
+ "type": "uint32"
14552
14558
  }
14553
14559
  ],
14554
14560
  "name": "WalletParametersUpdated",
@@ -14816,6 +14822,19 @@
14816
14822
  "stateMutability": "view",
14817
14823
  "type": "function"
14818
14824
  },
14825
+ {
14826
+ "inputs": [],
14827
+ "name": "governance",
14828
+ "outputs": [
14829
+ {
14830
+ "internalType": "address",
14831
+ "name": "",
14832
+ "type": "address"
14833
+ }
14834
+ ],
14835
+ "stateMutability": "view",
14836
+ "type": "function"
14837
+ },
14819
14838
  {
14820
14839
  "inputs": [
14821
14840
  {
@@ -14951,16 +14970,16 @@
14951
14970
  "type": "function"
14952
14971
  },
14953
14972
  {
14954
- "inputs": [],
14955
- "name": "owner",
14956
- "outputs": [
14973
+ "inputs": [
14957
14974
  {
14958
- "internalType": "address",
14959
- "name": "",
14960
- "type": "address"
14975
+ "internalType": "bytes20",
14976
+ "name": "walletPubKeyHash",
14977
+ "type": "bytes20"
14961
14978
  }
14962
14979
  ],
14963
- "stateMutability": "view",
14980
+ "name": "notifyWalletClosingPeriodElapsed",
14981
+ "outputs": [],
14982
+ "stateMutability": "nonpayable",
14964
14983
  "type": "function"
14965
14984
  },
14966
14985
  {
@@ -15037,13 +15056,6 @@
15037
15056
  "stateMutability": "view",
15038
15057
  "type": "function"
15039
15058
  },
15040
- {
15041
- "inputs": [],
15042
- "name": "renounceOwnership",
15043
- "outputs": [],
15044
- "stateMutability": "nonpayable",
15045
- "type": "function"
15046
- },
15047
15059
  {
15048
15060
  "inputs": [
15049
15061
  {
@@ -15620,11 +15632,11 @@
15620
15632
  "inputs": [
15621
15633
  {
15622
15634
  "internalType": "address",
15623
- "name": "newOwner",
15635
+ "name": "newGovernance",
15624
15636
  "type": "address"
15625
15637
  }
15626
15638
  ],
15627
- "name": "transferOwnership",
15639
+ "name": "transferGovernance",
15628
15640
  "outputs": [],
15629
15641
  "stateMutability": "nonpayable",
15630
15642
  "type": "function"
@@ -15778,6 +15790,11 @@
15778
15790
  "internalType": "uint64",
15779
15791
  "name": "walletMaxBtcTransfer",
15780
15792
  "type": "uint64"
15793
+ },
15794
+ {
15795
+ "internalType": "uint32",
15796
+ "name": "walletClosingPeriod",
15797
+ "type": "uint32"
15781
15798
  }
15782
15799
  ],
15783
15800
  "name": "updateWalletParameters",
@@ -15813,6 +15830,11 @@
15813
15830
  "internalType": "uint64",
15814
15831
  "name": "walletMaxBtcTransfer",
15815
15832
  "type": "uint64"
15833
+ },
15834
+ {
15835
+ "internalType": "uint32",
15836
+ "name": "walletClosingPeriod",
15837
+ "type": "uint32"
15816
15838
  }
15817
15839
  ],
15818
15840
  "stateMutability": "view",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keep-network/tbtc-v2",
3
- "version": "0.1.1-dev.45+main.fb5e5a106aa05cf683c2b926a00b8739fb2b4040",
3
+ "version": "0.1.1-dev.48+main.bb15e798df28cd67fe9df8837506dbd870e03217",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "artifacts/",