@keep-network/tbtc-v2 0.1.1-dev.24 → 0.1.1-dev.25
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/TBTC.json +3 -3
- package/artifacts/TBTCToken.json +3 -3
- package/artifacts/VendingMachine.json +10 -10
- package/artifacts/solcInputs/{2676c70e1dffa939dbf0519ef3304b34.json → 7823c0ea8f2f46d2393b3380efff7ecb.json} +2 -2
- package/build/contracts/GovernanceUtils.sol/GovernanceUtils.dbg.json +1 -1
- package/build/contracts/bank/Bank.sol/Bank.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/Bridge.sol/Bridge.json +144 -15
- package/build/contracts/bridge/Bridge.sol/IRelay.dbg.json +1 -1
- package/build/contracts/bridge/EcdsaLib.sol/EcdsaLib.dbg.json +1 -1
- package/build/contracts/bridge/VendingMachine.sol/VendingMachine.dbg.json +1 -1
- package/build/contracts/bridge/Wallets.sol/Wallets.dbg.json +1 -1
- package/build/contracts/bridge/Wallets.sol/Wallets.json +53 -2
- package/build/contracts/token/TBTC.sol/TBTC.dbg.json +1 -1
- package/build/contracts/vault/IVault.sol/IVault.dbg.json +1 -1
- package/build/contracts/vault/TBTCVault.sol/TBTCVault.dbg.json +1 -1
- package/contracts/bridge/Bridge.sol +55 -87
- package/contracts/bridge/Wallets.sol +172 -4
- package/package.json +1 -1
|
@@ -47,6 +47,25 @@
|
|
|
47
47
|
"name": "WalletBtcBalanceRangeUpdated",
|
|
48
48
|
"type": "event"
|
|
49
49
|
},
|
|
50
|
+
{
|
|
51
|
+
"anonymous": false,
|
|
52
|
+
"inputs": [
|
|
53
|
+
{
|
|
54
|
+
"indexed": true,
|
|
55
|
+
"internalType": "bytes32",
|
|
56
|
+
"name": "ecdsaWalletID",
|
|
57
|
+
"type": "bytes32"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"indexed": true,
|
|
61
|
+
"internalType": "bytes20",
|
|
62
|
+
"name": "walletPubKeyHash",
|
|
63
|
+
"type": "bytes20"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"name": "WalletClosed",
|
|
67
|
+
"type": "event"
|
|
68
|
+
},
|
|
50
69
|
{
|
|
51
70
|
"anonymous": false,
|
|
52
71
|
"inputs": [
|
|
@@ -60,6 +79,38 @@
|
|
|
60
79
|
"name": "WalletCreationPeriodUpdated",
|
|
61
80
|
"type": "event"
|
|
62
81
|
},
|
|
82
|
+
{
|
|
83
|
+
"anonymous": false,
|
|
84
|
+
"inputs": [
|
|
85
|
+
{
|
|
86
|
+
"indexed": false,
|
|
87
|
+
"internalType": "uint32",
|
|
88
|
+
"name": "newMaxAge",
|
|
89
|
+
"type": "uint32"
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
"name": "WalletMaxAgeUpdated",
|
|
93
|
+
"type": "event"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"anonymous": false,
|
|
97
|
+
"inputs": [
|
|
98
|
+
{
|
|
99
|
+
"indexed": true,
|
|
100
|
+
"internalType": "bytes32",
|
|
101
|
+
"name": "ecdsaWalletID",
|
|
102
|
+
"type": "bytes32"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"indexed": true,
|
|
106
|
+
"internalType": "bytes20",
|
|
107
|
+
"name": "walletPubKeyHash",
|
|
108
|
+
"type": "bytes20"
|
|
109
|
+
}
|
|
110
|
+
],
|
|
111
|
+
"name": "WalletMovingFunds",
|
|
112
|
+
"type": "event"
|
|
113
|
+
},
|
|
63
114
|
{
|
|
64
115
|
"anonymous": false,
|
|
65
116
|
"inputs": [
|
|
@@ -80,8 +131,8 @@
|
|
|
80
131
|
"type": "event"
|
|
81
132
|
}
|
|
82
133
|
],
|
|
83
|
-
"bytecode": "0x61116061003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe730000000000000000000000000000000000000000301460806040526004361061007c5760003560e01c8063b4e671f41161005a578063b4e671f4146100e3578063ea2a3dcc14610103578063f832341d1461012357600080fd5b8063041aee99146100815780634fd7d486146100a3578063998b564c146100c3575b600080fd5b81801561008d57600080fd5b506100a161009c366004610e71565b610143565b005b8180156100af57600080fd5b506100a16100be366004610e9d565b6101b3565b8180156100cf57600080fd5b506100a16100de366004610ee7565b6103c2565b8180156100ef57600080fd5b506100a16100fe366004610f23565b610559565b81801561010f57600080fd5b506100a161011e366004610f5b565b61085d565b81801561012f57600080fd5b506100a161013e366004610f9d565b61086b565b81547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff16600160a01b63ffffffff83169081029190911783556040519081527f0c96a98792be84d818dd96f4167766ce3fbb8fdbfece805d7c2ec87873797b629060200160405180910390a15050565b83546001600160a01b031633146102375760405162461bcd60e51b815260206004820152602760248201527f43616c6c6572206973206e6f74207468652045434453412057616c6c6574205260448201527f656769737472790000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b600061024b610246848461099a565b610a44565b61025490610fce565b6bffffffffffffffffffffffff198116600090815260028701602052604081209192506002820154600160601b900460ff1660048111156102975761029761100a565b1461030a5760405162461bcd60e51b815260206004820152602860248201527f45434453412077616c6c657420686173206265656e20616c726561647920726560448201527f6769737465726564000000000000000000000000000000000000000000000000606482015260840161022e565b84815560028101805463ffffffff4216680100000000000000009081026cffffffffff00000000000000001990921691909117600160601b17909155600187018054606085901c9092027fffffffff0000000000000000000000000000000000000000ffffffffffffffff9092169190911790556040516bffffffffffffffffffffffff1983169086907f2dbb47dce81d6b11cca1f1e3b10143d6f7e1e7e92d2dd9aacbb1f875379d308e90600090a3505050505050565b60008267ffffffffffffffff16116104425760405162461bcd60e51b815260206004820152602160248201527f4d696e696d756d206d7573742062652067726561746572207468616e207a657260448201527f6f00000000000000000000000000000000000000000000000000000000000000606482015260840161022e565b8167ffffffffffffffff168167ffffffffffffffff16116104cb5760405162461bcd60e51b815260206004820152602860248201527f4d6178696d756d206d7573742062652067726561746572207468616e2074686560448201527f206d696e696d756d000000000000000000000000000000000000000000000000606482015260840161022e565b825477ffffffffffffffffffffffffffffffffffffffffffffffff16600160c01b67ffffffffffffffff84811691820292909217855560018501805467ffffffffffffffff191692841692831790556040805191825260208201929092527f93f75d2a1ad31d60f2381eb935c4b4d8743c9607d7bfaeabeffc62fbf4e21182910160405180910390a1505050565b8154604080517fcc56238800000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163cc562388916004808301926020929190829003018186803b1580156105b657600080fd5b505afa1580156105ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ee9190611020565b60038111156105ff576105ff61100a565b146106725760405162461bcd60e51b815260206004820152602360248201527f57616c6c6574206372656174696f6e20616c726561647920696e2070726f677260448201527f6573730000000000000000000000000000000000000000000000000000000000606482015260840161022e565b600182015468010000000000000000900460601b6bffffffffffffffffffffffff198116156107b95760006106a8848385610b1a565b6bffffffffffffffffffffffff19831660009081526002808701602052604082200154865492935063ffffffff680100000000000000009091048116926106f891600160a01b9091041683611048565b63ffffffff1642101590508080156107265750855467ffffffffffffffff600160c01b909104811690841610155b806107435750600186015467ffffffffffffffff90811690841610155b6107b55760405162461bcd60e51b815260206004820152602660248201527f57616c6c6574206372656174696f6e20636f6e646974696f6e7320617265206e60448201527f6f74206d65740000000000000000000000000000000000000000000000000000606482015260840161022e565b5050505b6040517f31fecb80caf1e1128496dd5a6f1083ba29fd5fe64c3fe04e2d1b6f9cfc27d5a390600090a18254604080517f72cc8c6d00000000000000000000000000000000000000000000000000000000815290516001600160a01b03909216916372cc8c6d9160048082019260009290919082900301818387803b15801561084057600080fd5b505af1158015610854573d6000803e3d6000fd5b50505050505050565b6108678282610c52565b5050565b6001600160a01b0381166108e75760405162461bcd60e51b815260206004820152602c60248201527f45434453412057616c6c6574205265676973747279206164647265737320636160448201527f6e6e6f74206265207a65726f0000000000000000000000000000000000000000606482015260840161022e565b81546001600160a01b0316156109655760405162461bcd60e51b815260206004820152602960248201527f45434453412057616c6c6574205265676973747279206164647265737320616c60448201527f7265616479207365740000000000000000000000000000000000000000000000606482015260840161022e565b81547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0391909116179055565b606060006109a960028461107e565b6109d457507f02000000000000000000000000000000000000000000000000000000000000006109f7565b507f03000000000000000000000000000000000000000000000000000000000000005b6040517fff00000000000000000000000000000000000000000000000000000000000000821660208201526021810185905260410160405160208183030381529060405291505092915050565b60606003600283604051610a5891906110a0565b602060405180830381855afa158015610a75573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190610a9891906110db565b604051602001610aaa91815260200190565b60408051601f1981840301815290829052610ac4916110a0565b602060405180830381855afa158015610ae1573d6000803e3d6000fd5b5050604051805160601b6bffffffffffffffffffffffff1916602082015260340190506040516020818303038152906040529050919050565b6bffffffffffffffffffffffff19821660009081526002840160205260408120600101548015610c4a57808335610b5760408601602087016110f4565b610b67606087016040880161110f565b604051602001610bd49392919092835260e09190911b7fffffffff0000000000000000000000000000000000000000000000000000000016602083015260c01b7fffffffffffffffff000000000000000000000000000000000000000000000000166024820152602c0190565b6040516020818303038152906040528051906020012014610c375760405162461bcd60e51b815260206004820152601d60248201527f496e76616c69642077616c6c6574206d61696e205554584f2064617461000000604482015260640161022e565b610c47606084016040850161110f565b91505b509392505050565b6bffffffffffffffffffffffff1981166000908152600283016020526040902060016002820154600160601b900460ff166004811115610c9457610c9461100a565b1480610cbe5750600280820154600160601b900460ff166004811115610cbc57610cbc61100a565b145b610d305760405162461bcd60e51b815260206004820152603160248201527f45434453412077616c6c6574206d75737420626520696e204c697665206f722060448201527f4d6f76696e6746756e6473207374617465000000000000000000000000000000606482015260840161022e565b6002810180546cff00000000000000000000000019166c0400000000000000000000000017905580546040516bffffffffffffffffffffffff19841691907f9272a280b0f32f70b00ad0b546499c68e3ecc6f7bb7ef43491ec5d7b99bf69ef90600090a360018301546bffffffffffffffffffffffff198381166801000000000000000090920460601b161415610dec576001830180547fffffffff0000000000000000000000000000000000000000ffffffffffffffff1690555b82546040517f343bb9270000000000000000000000000000000000000000000000000000000081526bffffffffffffffffffffffff19841660048201526001600160a01b039091169063343bb92790602401600060405180830381600087803b15801561084057600080fd5b803563ffffffff81168114610e6c57600080fd5b919050565b60008060408385031215610e8457600080fd5b82359150610e9460208401610e58565b90509250929050565b60008060008060808587031215610eb357600080fd5b5050823594602084013594506040840135936060013592509050565b803567ffffffffffffffff81168114610e6c57600080fd5b600080600060608486031215610efc57600080fd5b83359250610f0c60208501610ecf565b9150610f1a60408501610ecf565b90509250925092565b6000808284036080811215610f3757600080fd5b833592506060601f1982011215610f4d57600080fd5b506020830190509250929050565b60008060408385031215610f6e57600080fd5b8235915060208301356bffffffffffffffffffffffff1981168114610f9257600080fd5b809150509250929050565b60008060408385031215610fb057600080fd5b8235915060208301356001600160a01b0381168114610f9257600080fd5b805160208201516bffffffffffffffffffffffff1980821692919060148310156110025780818460140360031b1b83161693505b505050919050565b634e487b7160e01b600052602160045260246000fd5b60006020828403121561103257600080fd5b81516004811061104157600080fd5b9392505050565b600063ffffffff80831681851680830382111561107557634e487b7160e01b600052601160045260246000fd5b01949350505050565b60008261109b57634e487b7160e01b600052601260045260246000fd5b500690565b6000825160005b818110156110c157602081860181015185830152016110a7565b818111156110d0576000828501525b509190910192915050565b6000602082840312156110ed57600080fd5b5051919050565b60006020828403121561110657600080fd5b61104182610e58565b60006020828403121561112157600080fd5b61104182610ecf56fea2646970667358221220cc7e3d226fb4d803c7329b0c3c4684fc02ebbbebcf6f9511da57986088085ed164736f6c63430008090033",
|
|
84
|
-
"deployedBytecode": "0x730000000000000000000000000000000000000000301460806040526004361061007c5760003560e01c8063b4e671f41161005a578063b4e671f4146100e3578063ea2a3dcc14610103578063f832341d1461012357600080fd5b8063041aee99146100815780634fd7d486146100a3578063998b564c146100c3575b600080fd5b81801561008d57600080fd5b506100a161009c366004610e71565b610143565b005b8180156100af57600080fd5b506100a16100be366004610e9d565b6101b3565b8180156100cf57600080fd5b506100a16100de366004610ee7565b6103c2565b8180156100ef57600080fd5b506100a16100fe366004610f23565b610559565b81801561010f57600080fd5b506100a161011e366004610f5b565b61085d565b81801561012f57600080fd5b506100a161013e366004610f9d565b61086b565b81547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff16600160a01b63ffffffff83169081029190911783556040519081527f0c96a98792be84d818dd96f4167766ce3fbb8fdbfece805d7c2ec87873797b629060200160405180910390a15050565b83546001600160a01b031633146102375760405162461bcd60e51b815260206004820152602760248201527f43616c6c6572206973206e6f74207468652045434453412057616c6c6574205260448201527f656769737472790000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b600061024b610246848461099a565b610a44565b61025490610fce565b6bffffffffffffffffffffffff198116600090815260028701602052604081209192506002820154600160601b900460ff1660048111156102975761029761100a565b1461030a5760405162461bcd60e51b815260206004820152602860248201527f45434453412077616c6c657420686173206265656e20616c726561647920726560448201527f6769737465726564000000000000000000000000000000000000000000000000606482015260840161022e565b84815560028101805463ffffffff4216680100000000000000009081026cffffffffff00000000000000001990921691909117600160601b17909155600187018054606085901c9092027fffffffff0000000000000000000000000000000000000000ffffffffffffffff9092169190911790556040516bffffffffffffffffffffffff1983169086907f2dbb47dce81d6b11cca1f1e3b10143d6f7e1e7e92d2dd9aacbb1f875379d308e90600090a3505050505050565b60008267ffffffffffffffff16116104425760405162461bcd60e51b815260206004820152602160248201527f4d696e696d756d206d7573742062652067726561746572207468616e207a657260448201527f6f00000000000000000000000000000000000000000000000000000000000000606482015260840161022e565b8167ffffffffffffffff168167ffffffffffffffff16116104cb5760405162461bcd60e51b815260206004820152602860248201527f4d6178696d756d206d7573742062652067726561746572207468616e2074686560448201527f206d696e696d756d000000000000000000000000000000000000000000000000606482015260840161022e565b825477ffffffffffffffffffffffffffffffffffffffffffffffff16600160c01b67ffffffffffffffff84811691820292909217855560018501805467ffffffffffffffff191692841692831790556040805191825260208201929092527f93f75d2a1ad31d60f2381eb935c4b4d8743c9607d7bfaeabeffc62fbf4e21182910160405180910390a1505050565b8154604080517fcc56238800000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163cc562388916004808301926020929190829003018186803b1580156105b657600080fd5b505afa1580156105ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ee9190611020565b60038111156105ff576105ff61100a565b146106725760405162461bcd60e51b815260206004820152602360248201527f57616c6c6574206372656174696f6e20616c726561647920696e2070726f677260448201527f6573730000000000000000000000000000000000000000000000000000000000606482015260840161022e565b600182015468010000000000000000900460601b6bffffffffffffffffffffffff198116156107b95760006106a8848385610b1a565b6bffffffffffffffffffffffff19831660009081526002808701602052604082200154865492935063ffffffff680100000000000000009091048116926106f891600160a01b9091041683611048565b63ffffffff1642101590508080156107265750855467ffffffffffffffff600160c01b909104811690841610155b806107435750600186015467ffffffffffffffff90811690841610155b6107b55760405162461bcd60e51b815260206004820152602660248201527f57616c6c6574206372656174696f6e20636f6e646974696f6e7320617265206e60448201527f6f74206d65740000000000000000000000000000000000000000000000000000606482015260840161022e565b5050505b6040517f31fecb80caf1e1128496dd5a6f1083ba29fd5fe64c3fe04e2d1b6f9cfc27d5a390600090a18254604080517f72cc8c6d00000000000000000000000000000000000000000000000000000000815290516001600160a01b03909216916372cc8c6d9160048082019260009290919082900301818387803b15801561084057600080fd5b505af1158015610854573d6000803e3d6000fd5b50505050505050565b6108678282610c52565b5050565b6001600160a01b0381166108e75760405162461bcd60e51b815260206004820152602c60248201527f45434453412057616c6c6574205265676973747279206164647265737320636160448201527f6e6e6f74206265207a65726f0000000000000000000000000000000000000000606482015260840161022e565b81546001600160a01b0316156109655760405162461bcd60e51b815260206004820152602960248201527f45434453412057616c6c6574205265676973747279206164647265737320616c60448201527f7265616479207365740000000000000000000000000000000000000000000000606482015260840161022e565b81547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0391909116179055565b606060006109a960028461107e565b6109d457507f02000000000000000000000000000000000000000000000000000000000000006109f7565b507f03000000000000000000000000000000000000000000000000000000000000005b6040517fff00000000000000000000000000000000000000000000000000000000000000821660208201526021810185905260410160405160208183030381529060405291505092915050565b60606003600283604051610a5891906110a0565b602060405180830381855afa158015610a75573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190610a9891906110db565b604051602001610aaa91815260200190565b60408051601f1981840301815290829052610ac4916110a0565b602060405180830381855afa158015610ae1573d6000803e3d6000fd5b5050604051805160601b6bffffffffffffffffffffffff1916602082015260340190506040516020818303038152906040529050919050565b6bffffffffffffffffffffffff19821660009081526002840160205260408120600101548015610c4a57808335610b5760408601602087016110f4565b610b67606087016040880161110f565b604051602001610bd49392919092835260e09190911b7fffffffff0000000000000000000000000000000000000000000000000000000016602083015260c01b7fffffffffffffffff000000000000000000000000000000000000000000000000166024820152602c0190565b6040516020818303038152906040528051906020012014610c375760405162461bcd60e51b815260206004820152601d60248201527f496e76616c69642077616c6c6574206d61696e205554584f2064617461000000604482015260640161022e565b610c47606084016040850161110f565b91505b509392505050565b6bffffffffffffffffffffffff1981166000908152600283016020526040902060016002820154600160601b900460ff166004811115610c9457610c9461100a565b1480610cbe5750600280820154600160601b900460ff166004811115610cbc57610cbc61100a565b145b610d305760405162461bcd60e51b815260206004820152603160248201527f45434453412077616c6c6574206d75737420626520696e204c697665206f722060448201527f4d6f76696e6746756e6473207374617465000000000000000000000000000000606482015260840161022e565b6002810180546cff00000000000000000000000019166c0400000000000000000000000017905580546040516bffffffffffffffffffffffff19841691907f9272a280b0f32f70b00ad0b546499c68e3ecc6f7bb7ef43491ec5d7b99bf69ef90600090a360018301546bffffffffffffffffffffffff198381166801000000000000000090920460601b161415610dec576001830180547fffffffff0000000000000000000000000000000000000000ffffffffffffffff1690555b82546040517f343bb9270000000000000000000000000000000000000000000000000000000081526bffffffffffffffffffffffff19841660048201526001600160a01b039091169063343bb92790602401600060405180830381600087803b15801561084057600080fd5b803563ffffffff81168114610e6c57600080fd5b919050565b60008060408385031215610e8457600080fd5b82359150610e9460208401610e58565b90509250929050565b60008060008060808587031215610eb357600080fd5b5050823594602084013594506040840135936060013592509050565b803567ffffffffffffffff81168114610e6c57600080fd5b600080600060608486031215610efc57600080fd5b83359250610f0c60208501610ecf565b9150610f1a60408501610ecf565b90509250925092565b6000808284036080811215610f3757600080fd5b833592506060601f1982011215610f4d57600080fd5b506020830190509250929050565b60008060408385031215610f6e57600080fd5b8235915060208301356bffffffffffffffffffffffff1981168114610f9257600080fd5b809150509250929050565b60008060408385031215610fb057600080fd5b8235915060208301356001600160a01b0381168114610f9257600080fd5b805160208201516bffffffffffffffffffffffff1980821692919060148310156110025780818460140360031b1b83161693505b505050919050565b634e487b7160e01b600052602160045260246000fd5b60006020828403121561103257600080fd5b81516004811061104157600080fd5b9392505050565b600063ffffffff80831681851680830382111561107557634e487b7160e01b600052601160045260246000fd5b01949350505050565b60008261109b57634e487b7160e01b600052601260045260246000fd5b500690565b6000825160005b818110156110c157602081860181015185830152016110a7565b818111156110d0576000828501525b509190910192915050565b6000602082840312156110ed57600080fd5b5051919050565b60006020828403121561110657600080fd5b61104182610e58565b60006020828403121561112157600080fd5b61104182610ecf56fea2646970667358221220cc7e3d226fb4d803c7329b0c3c4684fc02ebbbebcf6f9511da57986088085ed164736f6c63430008090033",
|
|
134
|
+
"bytecode": "0x61185761003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100c85760003560e01c80639655f02b11610080578063b4e671f411610065578063b4e671f4146101af578063ea2a3dcc146101cf578063f832341d146101ef57600080fd5b80639655f02b1461016f578063998b564c1461018f57600080fd5b806345d9969c116100b157806345d9969c1461010f5780634fd7d4861461012f57806365951fcf1461014f57600080fd5b8063041aee99146100cd5780631803c09e146100ef575b600080fd5b8180156100d957600080fd5b506100ed6100e8366004611505565b61020f565b005b8180156100fb57600080fd5b506100ed61010a366004611531565b610280565b81801561011b57600080fd5b506100ed61012a366004611505565b6103b1565b81801561013b57600080fd5b506100ed61014a36600461155d565b610411565b81801561015b57600080fd5b506100ed61016a3660046115a7565b6105ec565b81801561017b57600080fd5b506100ed61018a3660046115e2565b6106e1565b81801561019b57600080fd5b506100ed6101aa366004611637565b6108f6565b8180156101bb57600080fd5b506100ed6101ca36600461166a565b610a8d565b8180156101db57600080fd5b506100ed6101ea3660046115a7565b610d82565b8180156101fb57600080fd5b506100ed61020a36600461168e565b610d90565b81547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff16600160a01b63ffffffff83169081029190911783556040519081527f0c96a98792be84d818dd96f4167766ce3fbb8fdbfece805d7c2ec87873797b62906020015b60405180910390a15050565b82546001600160a01b031633146102ee5760405162461bcd60e51b815260206004820152602760248201527f43616c6c6572206973206e6f74207468652045434453412057616c6c657420526044820152666567697374727960c81b60648201526084015b60405180910390fd5b60006103026102fd8484610ebf565b610f69565b61030b906116ca565b905060016001600160601b031982166000908152600286810160205260409091200154600160801b900460ff16600481111561034957610349611701565b146103a15760405162461bcd60e51b815260206004820152602260248201527f45434453412077616c6c6574206d75737420626520696e204c69766520737461604482015261746560f01b60648201526084016102e5565b6103ab848261103a565b50505050565b6001820180546bffffffff000000000000000019166801000000000000000063ffffffff8416908102919091179091556040519081527fb9680823827cf58b566fd60a2a37e51011531b53fa90ff8f109d6d94921dde0090602001610274565b83546001600160a01b0316331461047a5760405162461bcd60e51b815260206004820152602760248201527f43616c6c6572206973206e6f74207468652045434453412057616c6c657420526044820152666567697374727960c81b60648201526084016102e5565b60006104896102fd8484610ebf565b610492906116ca565b6001600160601b03198116600090815260028701602052604081209192506002820154600160801b900460ff1660048111156104d0576104d0611701565b146105435760405162461bcd60e51b815260206004820152602860248201527f45434453412077616c6c657420686173206265656e20616c726561647920726560448201527f676973746572656400000000000000000000000000000000000000000000000060648201526084016102e5565b848155600281018054600160801b7fffffffffffffffffffffffffffffff00ffffffff00000000ffffffffffffffff909116680100000000000000004263ffffffff1602171790556001860180546bffffffffffffffffffffffff16600160601b606085901c021790556040516001600160601b031983169086907f2dbb47dce81d6b11cca1f1e3b10143d6f7e1e7e92d2dd9aacbb1f875379d308e90600090a3505050505050565b6001600160601b031981166000908152600283810160205260409091200154600160801b900460ff16600181600481111561062957610629611701565b14806106465750600281600481111561064457610644611701565b145b6106b85760405162461bcd60e51b815260206004820152603160248201527f45434453412077616c6c6574206d75737420626520696e204c697665206f722060448201527f4d6f76696e6746756e647320737461746500000000000000000000000000000060648201526084016102e5565b60018160048111156106cc576106cc611701565b14156106dc576106dc838361103a565b505050565b60018301546001600160601b0319838116600160601b90920460601b1614156107725760405162461bcd60e51b815260206004820152602c60248201527f4163746976652077616c6c65742063616e6e6f7420626520636f6e736964657260448201527f656420636c6f736561626c65000000000000000000000000000000000000000060648201526084016102e5565b6001600160601b031982166000908152600284016020526040902060016002820154600160801b900460ff1660048111156107af576107af611701565b146108075760405162461bcd60e51b815260206004820152602260248201527f45434453412077616c6c6574206d75737420626520696e204c69766520737461604482015261746560f01b60648201526084016102e5565b600184015460028201546000916108379163ffffffff680100000000000000009283900481169290910416611717565b63ffffffff164210159050808061087357508454600160c01b900467ffffffffffffffff166108678686866111f1565b67ffffffffffffffff16105b6108e55760405162461bcd60e51b815260206004820152603660248201527f57616c6c6574206e6565647320746f206265206f6c6420656e6f756768206f7260448201527f206861766520746f6f20666577207361746f736869730000000000000000000060648201526084016102e5565b6108ef858561103a565b5050505050565b60008267ffffffffffffffff16116109765760405162461bcd60e51b815260206004820152602160248201527f4d696e696d756d206d7573742062652067726561746572207468616e207a657260448201527f6f0000000000000000000000000000000000000000000000000000000000000060648201526084016102e5565b8167ffffffffffffffff168167ffffffffffffffff16116109ff5760405162461bcd60e51b815260206004820152602860248201527f4d6178696d756d206d7573742062652067726561746572207468616e2074686560448201527f206d696e696d756d00000000000000000000000000000000000000000000000060648201526084016102e5565b825477ffffffffffffffffffffffffffffffffffffffffffffffff16600160c01b67ffffffffffffffff84811691820292909217855560018501805467ffffffffffffffff191692841692831790556040805191825260208201929092527f93f75d2a1ad31d60f2381eb935c4b4d8743c9607d7bfaeabeffc62fbf4e21182910160405180910390a1505050565b8154604080517fcc56238800000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163cc562388916004808301926020929190829003018186803b158015610aea57600080fd5b505afa158015610afe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b22919061174d565b6003811115610b3357610b33611701565b14610ba65760405162461bcd60e51b815260206004820152602360248201527f57616c6c6574206372656174696f6e20616c726561647920696e2070726f677260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016102e5565b6001820154600160601b900460601b6001600160601b0319811615610cde576000610bd28483856111f1565b6001600160601b0319831660009081526002808701602052604082200154865492935063ffffffff68010000000000000000909104811692610c1d91600160a01b9091041683611717565b63ffffffff164210159050808015610c4b5750855467ffffffffffffffff600160c01b909104811690841610155b80610c685750600186015467ffffffffffffffff90811690841610155b610cda5760405162461bcd60e51b815260206004820152602660248201527f57616c6c6574206372656174696f6e20636f6e646974696f6e7320617265206e60448201527f6f74206d6574000000000000000000000000000000000000000000000000000060648201526084016102e5565b5050505b6040517f31fecb80caf1e1128496dd5a6f1083ba29fd5fe64c3fe04e2d1b6f9cfc27d5a390600090a18254604080517f72cc8c6d00000000000000000000000000000000000000000000000000000000815290516001600160a01b03909216916372cc8c6d9160048082019260009290919082900301818387803b158015610d6557600080fd5b505af1158015610d79573d6000803e3d6000fd5b50505050505050565b610d8c8282611324565b5050565b6001600160a01b038116610e0c5760405162461bcd60e51b815260206004820152602c60248201527f45434453412057616c6c6574205265676973747279206164647265737320636160448201527f6e6e6f74206265207a65726f000000000000000000000000000000000000000060648201526084016102e5565b81546001600160a01b031615610e8a5760405162461bcd60e51b815260206004820152602960248201527f45434453412057616c6c6574205265676973747279206164647265737320616c60448201527f726561647920736574000000000000000000000000000000000000000000000060648201526084016102e5565b81547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0391909116179055565b60606000610ece600284611775565b610ef957507f0200000000000000000000000000000000000000000000000000000000000000610f1c565b507f03000000000000000000000000000000000000000000000000000000000000005b6040517fff00000000000000000000000000000000000000000000000000000000000000821660208201526021810185905260410160405160208183030381529060405291505092915050565b60606003600283604051610f7d9190611797565b602060405180830381855afa158015610f9a573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190610fbd91906117d2565b604051602001610fcf91815260200190565b60408051601f1981840301815290829052610fe991611797565b602060405180830381855afa158015611006573d6000803e3d6000fd5b5050604051805160601b6001600160601b031916602082015260340190506040516020818303038152906040529050919050565b6001600160601b0319811660009081526002830160205260409020600181015461112f5760028101805470ff00000000000000000000000000000000191670030000000000000000000000000000000017905580546040516001600160601b0319841691907f47b159947c3066cb253f60e8f046cfd747411788a545cb189679e3fa1467b28d90600090a38254815460405163343bb92760e01b81526001600160a01b039092169163343bb927916110f89160040190815260200190565b600060405180830381600087803b15801561111257600080fd5b505af1158015611126573d6000803e3d6000fd5b505050506111b5565b60028101805463ffffffff4216600160601b027fffffffffffffffffffffffffffffff0000000000ffffffffffffffffffffffff9091161770020000000000000000000000000000000017905580546040516001600160601b0319841691907fbdc9ce990a067e5fd3a5d8dfc68e27e9f221aaa3fe55265e0b7e93c460b3efe290600090a35b60018301546001600160601b0319838116600160601b90920460601b1614156106dc57505060010180546bffffffffffffffffffffffff169055565b6001600160601b031982166000908152600284016020526040812060010154801561131c5780833561122960408601602087016117eb565b6112396060870160408801611806565b6040516020016112a69392919092835260e09190911b7fffffffff0000000000000000000000000000000000000000000000000000000016602083015260c01b7fffffffffffffffff000000000000000000000000000000000000000000000000166024820152602c0190565b60405160208183030381529060405280519060200120146113095760405162461bcd60e51b815260206004820152601d60248201527f496e76616c69642077616c6c6574206d61696e205554584f206461746100000060448201526064016102e5565b6113196060840160408501611806565b91505b509392505050565b6001600160601b031981166000908152600283016020526040902060016002820154600160801b900460ff16600481111561136157611361611701565b148061138b5750600280820154600160801b900460ff16600481111561138957611389611701565b145b6113fd5760405162461bcd60e51b815260206004820152603160248201527f45434453412077616c6c6574206d75737420626520696e204c697665206f722060448201527f4d6f76696e6746756e647320737461746500000000000000000000000000000060648201526084016102e5565b60028101805470ff00000000000000000000000000000000191670040000000000000000000000000000000017905580546040516001600160601b0319841691907f9272a280b0f32f70b00ad0b546499c68e3ecc6f7bb7ef43491ec5d7b99bf69ef90600090a360018301546001600160601b0319838116600160601b90920460601b16141561149e576001830180546bffffffffffffffffffffffff1690555b825460405163343bb92760e01b81526001600160601b0319841660048201526001600160a01b039091169063343bb92790602401600060405180830381600087803b158015610d6557600080fd5b803563ffffffff8116811461150057600080fd5b919050565b6000806040838503121561151857600080fd5b82359150611528602084016114ec565b90509250929050565b60008060006060848603121561154657600080fd5b505081359360208301359350604090920135919050565b6000806000806080858703121561157357600080fd5b5050823594602084013594506040840135936060013592509050565b80356001600160601b03198116811461150057600080fd5b600080604083850312156115ba57600080fd5b823591506115286020840161158f565b6000606082840312156115dc57600080fd5b50919050565b600080600060a084860312156115f757600080fd5b833592506116076020850161158f565b915061161685604086016115ca565b90509250925092565b803567ffffffffffffffff8116811461150057600080fd5b60008060006060848603121561164c57600080fd5b8335925061165c6020850161161f565b91506116166040850161161f565b6000806080838503121561167d57600080fd5b8235915061152884602085016115ca565b600080604083850312156116a157600080fd5b8235915060208301356001600160a01b03811681146116bf57600080fd5b809150509250929050565b805160208201516001600160601b031980821692919060148310156116f95780818460140360031b1b83161693505b505050919050565b634e487b7160e01b600052602160045260246000fd5b600063ffffffff80831681851680830382111561174457634e487b7160e01b600052601160045260246000fd5b01949350505050565b60006020828403121561175f57600080fd5b81516004811061176e57600080fd5b9392505050565b60008261179257634e487b7160e01b600052601260045260246000fd5b500690565b6000825160005b818110156117b8576020818601810151858301520161179e565b818111156117c7576000828501525b509190910192915050565b6000602082840312156117e457600080fd5b5051919050565b6000602082840312156117fd57600080fd5b61176e826114ec565b60006020828403121561181857600080fd5b61176e8261161f56fea264697066735822122051de5df8d3b79b15ac0b9e609c4eeaa944ec9f3cfcd6b5760f508d304ebc224064736f6c63430008090033",
|
|
135
|
+
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100c85760003560e01c80639655f02b11610080578063b4e671f411610065578063b4e671f4146101af578063ea2a3dcc146101cf578063f832341d146101ef57600080fd5b80639655f02b1461016f578063998b564c1461018f57600080fd5b806345d9969c116100b157806345d9969c1461010f5780634fd7d4861461012f57806365951fcf1461014f57600080fd5b8063041aee99146100cd5780631803c09e146100ef575b600080fd5b8180156100d957600080fd5b506100ed6100e8366004611505565b61020f565b005b8180156100fb57600080fd5b506100ed61010a366004611531565b610280565b81801561011b57600080fd5b506100ed61012a366004611505565b6103b1565b81801561013b57600080fd5b506100ed61014a36600461155d565b610411565b81801561015b57600080fd5b506100ed61016a3660046115a7565b6105ec565b81801561017b57600080fd5b506100ed61018a3660046115e2565b6106e1565b81801561019b57600080fd5b506100ed6101aa366004611637565b6108f6565b8180156101bb57600080fd5b506100ed6101ca36600461166a565b610a8d565b8180156101db57600080fd5b506100ed6101ea3660046115a7565b610d82565b8180156101fb57600080fd5b506100ed61020a36600461168e565b610d90565b81547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff16600160a01b63ffffffff83169081029190911783556040519081527f0c96a98792be84d818dd96f4167766ce3fbb8fdbfece805d7c2ec87873797b62906020015b60405180910390a15050565b82546001600160a01b031633146102ee5760405162461bcd60e51b815260206004820152602760248201527f43616c6c6572206973206e6f74207468652045434453412057616c6c657420526044820152666567697374727960c81b60648201526084015b60405180910390fd5b60006103026102fd8484610ebf565b610f69565b61030b906116ca565b905060016001600160601b031982166000908152600286810160205260409091200154600160801b900460ff16600481111561034957610349611701565b146103a15760405162461bcd60e51b815260206004820152602260248201527f45434453412077616c6c6574206d75737420626520696e204c69766520737461604482015261746560f01b60648201526084016102e5565b6103ab848261103a565b50505050565b6001820180546bffffffff000000000000000019166801000000000000000063ffffffff8416908102919091179091556040519081527fb9680823827cf58b566fd60a2a37e51011531b53fa90ff8f109d6d94921dde0090602001610274565b83546001600160a01b0316331461047a5760405162461bcd60e51b815260206004820152602760248201527f43616c6c6572206973206e6f74207468652045434453412057616c6c657420526044820152666567697374727960c81b60648201526084016102e5565b60006104896102fd8484610ebf565b610492906116ca565b6001600160601b03198116600090815260028701602052604081209192506002820154600160801b900460ff1660048111156104d0576104d0611701565b146105435760405162461bcd60e51b815260206004820152602860248201527f45434453412077616c6c657420686173206265656e20616c726561647920726560448201527f676973746572656400000000000000000000000000000000000000000000000060648201526084016102e5565b848155600281018054600160801b7fffffffffffffffffffffffffffffff00ffffffff00000000ffffffffffffffff909116680100000000000000004263ffffffff1602171790556001860180546bffffffffffffffffffffffff16600160601b606085901c021790556040516001600160601b031983169086907f2dbb47dce81d6b11cca1f1e3b10143d6f7e1e7e92d2dd9aacbb1f875379d308e90600090a3505050505050565b6001600160601b031981166000908152600283810160205260409091200154600160801b900460ff16600181600481111561062957610629611701565b14806106465750600281600481111561064457610644611701565b145b6106b85760405162461bcd60e51b815260206004820152603160248201527f45434453412077616c6c6574206d75737420626520696e204c697665206f722060448201527f4d6f76696e6746756e647320737461746500000000000000000000000000000060648201526084016102e5565b60018160048111156106cc576106cc611701565b14156106dc576106dc838361103a565b505050565b60018301546001600160601b0319838116600160601b90920460601b1614156107725760405162461bcd60e51b815260206004820152602c60248201527f4163746976652077616c6c65742063616e6e6f7420626520636f6e736964657260448201527f656420636c6f736561626c65000000000000000000000000000000000000000060648201526084016102e5565b6001600160601b031982166000908152600284016020526040902060016002820154600160801b900460ff1660048111156107af576107af611701565b146108075760405162461bcd60e51b815260206004820152602260248201527f45434453412077616c6c6574206d75737420626520696e204c69766520737461604482015261746560f01b60648201526084016102e5565b600184015460028201546000916108379163ffffffff680100000000000000009283900481169290910416611717565b63ffffffff164210159050808061087357508454600160c01b900467ffffffffffffffff166108678686866111f1565b67ffffffffffffffff16105b6108e55760405162461bcd60e51b815260206004820152603660248201527f57616c6c6574206e6565647320746f206265206f6c6420656e6f756768206f7260448201527f206861766520746f6f20666577207361746f736869730000000000000000000060648201526084016102e5565b6108ef858561103a565b5050505050565b60008267ffffffffffffffff16116109765760405162461bcd60e51b815260206004820152602160248201527f4d696e696d756d206d7573742062652067726561746572207468616e207a657260448201527f6f0000000000000000000000000000000000000000000000000000000000000060648201526084016102e5565b8167ffffffffffffffff168167ffffffffffffffff16116109ff5760405162461bcd60e51b815260206004820152602860248201527f4d6178696d756d206d7573742062652067726561746572207468616e2074686560448201527f206d696e696d756d00000000000000000000000000000000000000000000000060648201526084016102e5565b825477ffffffffffffffffffffffffffffffffffffffffffffffff16600160c01b67ffffffffffffffff84811691820292909217855560018501805467ffffffffffffffff191692841692831790556040805191825260208201929092527f93f75d2a1ad31d60f2381eb935c4b4d8743c9607d7bfaeabeffc62fbf4e21182910160405180910390a1505050565b8154604080517fcc56238800000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163cc562388916004808301926020929190829003018186803b158015610aea57600080fd5b505afa158015610afe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b22919061174d565b6003811115610b3357610b33611701565b14610ba65760405162461bcd60e51b815260206004820152602360248201527f57616c6c6574206372656174696f6e20616c726561647920696e2070726f677260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016102e5565b6001820154600160601b900460601b6001600160601b0319811615610cde576000610bd28483856111f1565b6001600160601b0319831660009081526002808701602052604082200154865492935063ffffffff68010000000000000000909104811692610c1d91600160a01b9091041683611717565b63ffffffff164210159050808015610c4b5750855467ffffffffffffffff600160c01b909104811690841610155b80610c685750600186015467ffffffffffffffff90811690841610155b610cda5760405162461bcd60e51b815260206004820152602660248201527f57616c6c6574206372656174696f6e20636f6e646974696f6e7320617265206e60448201527f6f74206d6574000000000000000000000000000000000000000000000000000060648201526084016102e5565b5050505b6040517f31fecb80caf1e1128496dd5a6f1083ba29fd5fe64c3fe04e2d1b6f9cfc27d5a390600090a18254604080517f72cc8c6d00000000000000000000000000000000000000000000000000000000815290516001600160a01b03909216916372cc8c6d9160048082019260009290919082900301818387803b158015610d6557600080fd5b505af1158015610d79573d6000803e3d6000fd5b50505050505050565b610d8c8282611324565b5050565b6001600160a01b038116610e0c5760405162461bcd60e51b815260206004820152602c60248201527f45434453412057616c6c6574205265676973747279206164647265737320636160448201527f6e6e6f74206265207a65726f000000000000000000000000000000000000000060648201526084016102e5565b81546001600160a01b031615610e8a5760405162461bcd60e51b815260206004820152602960248201527f45434453412057616c6c6574205265676973747279206164647265737320616c60448201527f726561647920736574000000000000000000000000000000000000000000000060648201526084016102e5565b81547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0391909116179055565b60606000610ece600284611775565b610ef957507f0200000000000000000000000000000000000000000000000000000000000000610f1c565b507f03000000000000000000000000000000000000000000000000000000000000005b6040517fff00000000000000000000000000000000000000000000000000000000000000821660208201526021810185905260410160405160208183030381529060405291505092915050565b60606003600283604051610f7d9190611797565b602060405180830381855afa158015610f9a573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190610fbd91906117d2565b604051602001610fcf91815260200190565b60408051601f1981840301815290829052610fe991611797565b602060405180830381855afa158015611006573d6000803e3d6000fd5b5050604051805160601b6001600160601b031916602082015260340190506040516020818303038152906040529050919050565b6001600160601b0319811660009081526002830160205260409020600181015461112f5760028101805470ff00000000000000000000000000000000191670030000000000000000000000000000000017905580546040516001600160601b0319841691907f47b159947c3066cb253f60e8f046cfd747411788a545cb189679e3fa1467b28d90600090a38254815460405163343bb92760e01b81526001600160a01b039092169163343bb927916110f89160040190815260200190565b600060405180830381600087803b15801561111257600080fd5b505af1158015611126573d6000803e3d6000fd5b505050506111b5565b60028101805463ffffffff4216600160601b027fffffffffffffffffffffffffffffff0000000000ffffffffffffffffffffffff9091161770020000000000000000000000000000000017905580546040516001600160601b0319841691907fbdc9ce990a067e5fd3a5d8dfc68e27e9f221aaa3fe55265e0b7e93c460b3efe290600090a35b60018301546001600160601b0319838116600160601b90920460601b1614156106dc57505060010180546bffffffffffffffffffffffff169055565b6001600160601b031982166000908152600284016020526040812060010154801561131c5780833561122960408601602087016117eb565b6112396060870160408801611806565b6040516020016112a69392919092835260e09190911b7fffffffff0000000000000000000000000000000000000000000000000000000016602083015260c01b7fffffffffffffffff000000000000000000000000000000000000000000000000166024820152602c0190565b60405160208183030381529060405280519060200120146113095760405162461bcd60e51b815260206004820152601d60248201527f496e76616c69642077616c6c6574206d61696e205554584f206461746100000060448201526064016102e5565b6113196060840160408501611806565b91505b509392505050565b6001600160601b031981166000908152600283016020526040902060016002820154600160801b900460ff16600481111561136157611361611701565b148061138b5750600280820154600160801b900460ff16600481111561138957611389611701565b145b6113fd5760405162461bcd60e51b815260206004820152603160248201527f45434453412077616c6c6574206d75737420626520696e204c697665206f722060448201527f4d6f76696e6746756e647320737461746500000000000000000000000000000060648201526084016102e5565b60028101805470ff00000000000000000000000000000000191670040000000000000000000000000000000017905580546040516001600160601b0319841691907f9272a280b0f32f70b00ad0b546499c68e3ecc6f7bb7ef43491ec5d7b99bf69ef90600090a360018301546001600160601b0319838116600160601b90920460601b16141561149e576001830180546bffffffffffffffffffffffff1690555b825460405163343bb92760e01b81526001600160601b0319841660048201526001600160a01b039091169063343bb92790602401600060405180830381600087803b158015610d6557600080fd5b803563ffffffff8116811461150057600080fd5b919050565b6000806040838503121561151857600080fd5b82359150611528602084016114ec565b90509250929050565b60008060006060848603121561154657600080fd5b505081359360208301359350604090920135919050565b6000806000806080858703121561157357600080fd5b5050823594602084013594506040840135936060013592509050565b80356001600160601b03198116811461150057600080fd5b600080604083850312156115ba57600080fd5b823591506115286020840161158f565b6000606082840312156115dc57600080fd5b50919050565b600080600060a084860312156115f757600080fd5b833592506116076020850161158f565b915061161685604086016115ca565b90509250925092565b803567ffffffffffffffff8116811461150057600080fd5b60008060006060848603121561164c57600080fd5b8335925061165c6020850161161f565b91506116166040850161161f565b6000806080838503121561167d57600080fd5b8235915061152884602085016115ca565b600080604083850312156116a157600080fd5b8235915060208301356001600160a01b03811681146116bf57600080fd5b809150509250929050565b805160208201516001600160601b031980821692919060148310156116f95780818460140360031b1b83161693505b505050919050565b634e487b7160e01b600052602160045260246000fd5b600063ffffffff80831681851680830382111561174457634e487b7160e01b600052601160045260246000fd5b01949350505050565b60006020828403121561175f57600080fd5b81516004811061176e57600080fd5b9392505050565b60008261179257634e487b7160e01b600052601260045260246000fd5b500690565b6000825160005b818110156117b8576020818601810151858301520161179e565b818111156117c7576000828501525b509190910192915050565b6000602082840312156117e457600080fd5b5051919050565b6000602082840312156117fd57600080fd5b61176e826114ec565b60006020828403121561181857600080fd5b61176e8261161f56fea264697066735822122051de5df8d3b79b15ac0b9e609c4eeaa944ec9f3cfcd6b5760f508d304ebc224064736f6c63430008090033",
|
|
85
136
|
"linkReferences": {},
|
|
86
137
|
"deployedLinkReferences": {}
|
|
87
138
|
}
|
|
@@ -275,8 +275,6 @@ contract Bridge is Ownable, EcdsaWalletOwner {
|
|
|
275
275
|
/// successfully
|
|
276
276
|
/// - `notifyRedemptionTimeout` in case the request was reported
|
|
277
277
|
/// to be timed out
|
|
278
|
-
/// - `submitRedemptionFraudProof` in case the request was handled
|
|
279
|
-
/// in an fraudulent way amount-wise.
|
|
280
278
|
mapping(uint256 => RedemptionRequest) public pendingRedemptions;
|
|
281
279
|
|
|
282
280
|
/// @notice Collection of all timed out redemptions requests indexed by
|
|
@@ -307,6 +305,8 @@ contract Bridge is Ownable, EcdsaWalletOwner {
|
|
|
307
305
|
uint64 newMaxBtcBalance
|
|
308
306
|
);
|
|
309
307
|
|
|
308
|
+
event WalletMaxAgeUpdated(uint32 newMaxAge);
|
|
309
|
+
|
|
310
310
|
event NewWalletRequested();
|
|
311
311
|
|
|
312
312
|
event NewWalletRegistered(
|
|
@@ -314,6 +314,16 @@ contract Bridge is Ownable, EcdsaWalletOwner {
|
|
|
314
314
|
bytes20 indexed walletPubKeyHash
|
|
315
315
|
);
|
|
316
316
|
|
|
317
|
+
event WalletMovingFunds(
|
|
318
|
+
bytes32 indexed ecdsaWalletID,
|
|
319
|
+
bytes20 indexed walletPubKeyHash
|
|
320
|
+
);
|
|
321
|
+
|
|
322
|
+
event WalletClosed(
|
|
323
|
+
bytes32 indexed ecdsaWalletID,
|
|
324
|
+
bytes20 indexed walletPubKeyHash
|
|
325
|
+
);
|
|
326
|
+
|
|
317
327
|
event WalletTerminated(
|
|
318
328
|
bytes32 indexed ecdsaWalletID,
|
|
319
329
|
bytes20 indexed walletPubKeyHash
|
|
@@ -380,12 +390,14 @@ contract Bridge is Ownable, EcdsaWalletOwner {
|
|
|
380
390
|
wallets.init(_ecdsaWalletRegistry);
|
|
381
391
|
wallets.setCreationPeriod(1 weeks);
|
|
382
392
|
wallets.setBtcBalanceRange(1 * 1e8, 10 * 1e8); // [1 BTC, 10 BTC]
|
|
393
|
+
wallets.setMaxAge(26 weeks); // ~6 months
|
|
383
394
|
}
|
|
384
395
|
|
|
385
396
|
/// @notice Updates parameters used by the `Wallets` library.
|
|
386
397
|
/// @param creationPeriod New value of the wallet creation period
|
|
387
398
|
/// @param minBtcBalance New value of the minimum BTC balance
|
|
388
399
|
/// @param maxBtcBalance New value of the maximum BTC balance
|
|
400
|
+
/// @param maxAge New value of the wallet maximum age
|
|
389
401
|
/// @dev Requirements:
|
|
390
402
|
/// - Caller must be the contract owner.
|
|
391
403
|
/// - Minimum BTC balance must be greater than zero
|
|
@@ -393,29 +405,34 @@ contract Bridge is Ownable, EcdsaWalletOwner {
|
|
|
393
405
|
function updateWalletsParameters(
|
|
394
406
|
uint32 creationPeriod,
|
|
395
407
|
uint64 minBtcBalance,
|
|
396
|
-
uint64 maxBtcBalance
|
|
408
|
+
uint64 maxBtcBalance,
|
|
409
|
+
uint32 maxAge
|
|
397
410
|
) external onlyOwner {
|
|
398
411
|
wallets.setCreationPeriod(creationPeriod);
|
|
399
412
|
wallets.setBtcBalanceRange(minBtcBalance, maxBtcBalance);
|
|
413
|
+
wallets.setMaxAge(maxAge);
|
|
400
414
|
}
|
|
401
415
|
|
|
402
416
|
/// @return creationPeriod Value of the wallet creation period
|
|
403
417
|
/// @return minBtcBalance Value of the minimum BTC balance
|
|
404
418
|
/// @return maxBtcBalance Value of the maximum BTC balance
|
|
419
|
+
/// @return maxAge Value of the wallet max age
|
|
405
420
|
function getWalletsParameters()
|
|
406
421
|
external
|
|
407
422
|
view
|
|
408
423
|
returns (
|
|
409
424
|
uint32 creationPeriod,
|
|
410
425
|
uint64 minBtcBalance,
|
|
411
|
-
uint64 maxBtcBalance
|
|
426
|
+
uint64 maxBtcBalance,
|
|
427
|
+
uint32 maxAge
|
|
412
428
|
)
|
|
413
429
|
{
|
|
414
430
|
creationPeriod = wallets.creationPeriod;
|
|
415
431
|
minBtcBalance = wallets.minBtcBalance;
|
|
416
432
|
maxBtcBalance = wallets.maxBtcBalance;
|
|
433
|
+
maxAge = wallets.maxAge;
|
|
417
434
|
|
|
418
|
-
return (creationPeriod, minBtcBalance, maxBtcBalance);
|
|
435
|
+
return (creationPeriod, minBtcBalance, maxBtcBalance, maxAge);
|
|
419
436
|
}
|
|
420
437
|
|
|
421
438
|
/// @notice Allows the Governance to mark the given vault address as trusted
|
|
@@ -478,13 +495,41 @@ contract Bridge is Ownable, EcdsaWalletOwner {
|
|
|
478
495
|
wallets.registerNewWallet(ecdsaWalletID, publicKeyX, publicKeyY);
|
|
479
496
|
}
|
|
480
497
|
|
|
481
|
-
|
|
498
|
+
/// @notice A callback function that is called by the ECDSA Wallet Registry
|
|
499
|
+
/// once a wallet heartbeat failure is detected.
|
|
500
|
+
/// @param publicKeyX Wallet's public key's X coordinate
|
|
501
|
+
/// @param publicKeyY Wallet's public key's Y coordinate
|
|
502
|
+
/// @dev Requirements:
|
|
503
|
+
/// - The only caller authorized to call this function is `registry`
|
|
504
|
+
/// - Wallet must be in Live state
|
|
482
505
|
function __ecdsaWalletHeartbeatFailedCallback(
|
|
483
|
-
bytes32
|
|
506
|
+
bytes32,
|
|
484
507
|
bytes32 publicKeyX,
|
|
485
508
|
bytes32 publicKeyY
|
|
486
509
|
) external override {
|
|
487
|
-
|
|
510
|
+
wallets.notifyWalletHeartbeatFailed(publicKeyX, publicKeyY);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/// @notice Notifies that the wallet is either old enough or has too few
|
|
514
|
+
/// satoshis left and qualifies to be closed.
|
|
515
|
+
/// @param walletPubKeyHash 20-byte public key hash of the wallet
|
|
516
|
+
/// @param walletMainUtxo Data of the wallet's main UTXO, as currently
|
|
517
|
+
/// known on the Ethereum chain.
|
|
518
|
+
/// @dev Requirements:
|
|
519
|
+
/// - Wallet must not be set as the current active wallet
|
|
520
|
+
/// - Wallet must exceed the wallet maximum age OR the wallet BTC
|
|
521
|
+
/// balance must be lesser than the minimum threshold. If the latter
|
|
522
|
+
/// case is true, the `walletMainUtxo` components must point to the
|
|
523
|
+
/// recent main UTXO of the given wallet, as currently known on the
|
|
524
|
+
/// Ethereum chain. If the wallet has no main UTXO, this parameter
|
|
525
|
+
/// can be empty as it is ignored since the wallet balance is
|
|
526
|
+
/// assumed to be zero.
|
|
527
|
+
/// - Wallet must be in Live state
|
|
528
|
+
function notifyCloseableWallet(
|
|
529
|
+
bytes20 walletPubKeyHash,
|
|
530
|
+
BitcoinTx.UTXO calldata walletMainUtxo
|
|
531
|
+
) external {
|
|
532
|
+
wallets.notifyCloseableWallet(walletPubKeyHash, walletMainUtxo);
|
|
488
533
|
}
|
|
489
534
|
|
|
490
535
|
/// @notice Gets details about a registered wallet.
|
|
@@ -1647,83 +1692,6 @@ contract Bridge is Ownable, EcdsaWalletOwner {
|
|
|
1647
1692
|
// 7. Reduce the `pendingRedemptionsValue` (`wallets` mapping) for
|
|
1648
1693
|
// given wallet by request's redeemable amount computed as
|
|
1649
1694
|
// `requestedAmount - treasuryFee`.
|
|
1650
|
-
// 8.
|
|
1651
|
-
//
|
|
1652
|
-
// order to prevent against new redemption requests hitting
|
|
1653
|
-
// that wallet.
|
|
1654
|
-
// 10. Expect the wallet to transfer its funds to another healthy
|
|
1655
|
-
// wallet (just as in case of failed heartbeat). The wallet is
|
|
1656
|
-
// expected to finish the already queued redemption requests
|
|
1657
|
-
// before moving funds but we are not going to enforce it on-chain.
|
|
1658
|
-
|
|
1659
|
-
// TODO: Function `submitRedemptionFraudProof`
|
|
1660
|
-
//
|
|
1661
|
-
// Deposit and redemption fraud proofs are challenging to implement
|
|
1662
|
-
// and it may happen we will have to rely on the coverage pool
|
|
1663
|
-
// (https://github.com/keep-network/coverage-pools) and DAO to
|
|
1664
|
-
// reimburse unlucky depositors and bring back the balance to the
|
|
1665
|
-
// system in case of a wallet fraud by liquidating a part of the
|
|
1666
|
-
// coverage pool manually.
|
|
1667
|
-
//
|
|
1668
|
-
// The probability of 51-of-100 wallet being fraudulent is negligible:
|
|
1669
|
-
// https://github.com/keep-network/tbtc-v2/blob/main/docs/rfc/rfc-2.adoc#111-group-size-and-threshold
|
|
1670
|
-
// and the coverage pool would be there to bring the balance back in
|
|
1671
|
-
// case we are unlucky and malicious wallet emerges.
|
|
1672
|
-
//
|
|
1673
|
-
// We do not want to slash for a misbehavior that is not provable
|
|
1674
|
-
// on-chain and it is possible to construct such a Bitcoin transaction
|
|
1675
|
-
// that is not provable on Ethereum, see
|
|
1676
|
-
// https://consensys.net/diligence/blog/2020/05/tbtc-navigating-the-cross-chain-conundrum
|
|
1677
|
-
//
|
|
1678
|
-
// The algorithm described below assumes we will be able to prove the
|
|
1679
|
-
// TX on Ethereum which may not always be the case. Consider the steps
|
|
1680
|
-
// below as an idea, and not necessarily how this function will be
|
|
1681
|
-
// implemented because it may happen this function will never be
|
|
1682
|
-
// implemented, given the Bitcoin transaction size problems.
|
|
1683
|
-
//
|
|
1684
|
-
// The algorithm:
|
|
1685
|
-
// 1. Take a `BitcoinTx.Info` and `BitcoinTx.Proof` of the
|
|
1686
|
-
// fraudulent transaction. It should also accept `walletPubKeyHash`
|
|
1687
|
-
// and index of fraudulent output. Probably index of fraudulent
|
|
1688
|
-
// input will be also required if the transaction is supposed
|
|
1689
|
-
// to have a bad input vector.
|
|
1690
|
-
// 2. Perform SPV proof to make sure it occurred on Bitcoin chain.
|
|
1691
|
-
// If not - revert.
|
|
1692
|
-
// 3. Check if wallet state is Live or MovingFunds. If not, revert.
|
|
1693
|
-
// 4. Validate the number of inputs. If there is one input and it
|
|
1694
|
-
// points to the wallet's main UTXO - move to point 5. If there
|
|
1695
|
-
// are multiple inputs and there is wallet's main UTXO in the set,
|
|
1696
|
-
// check if this is a sweep transaction. If it's not a sweep,
|
|
1697
|
-
// consider it as fraudulent and move to point 6.
|
|
1698
|
-
// In all other cases revert the call.
|
|
1699
|
-
// 5. Extract the output and analyze its type. The output is not
|
|
1700
|
-
// a fraud and the call should be reverted ONLY IF one of the
|
|
1701
|
-
// following conditions is true:
|
|
1702
|
-
// - Output is a requested redemption held by `pendingRedemptions`
|
|
1703
|
-
// and output value fulfills the request range. There is an
|
|
1704
|
-
// open question if a misfunded request should be removed
|
|
1705
|
-
// from `pendingRedemptions` (probably yes) and whether the
|
|
1706
|
-
// redeemer should be reimbursed in case of an underfund.
|
|
1707
|
-
// - Output is a timed out redemption held by `timedOutRedemptions`
|
|
1708
|
-
// and output value fulfills the request range.
|
|
1709
|
-
// - Output is a proper change i.e. a single output targeting
|
|
1710
|
-
// the wallet PKH back and having a non-zero value.
|
|
1711
|
-
// - Wallet is in MovingFunds state, the output points to the
|
|
1712
|
-
// expected target wallet, have non-zero value, and is a single
|
|
1713
|
-
// output in the vector.
|
|
1714
|
-
// In all other cases consider the transaction as fraud and
|
|
1715
|
-
// proceed to point 6.
|
|
1716
|
-
// 6. Punish the wallet, probably by severely slashing its operators.
|
|
1717
|
-
// 7. Change wallet's state in `wallets` mapping to `Terminated` in
|
|
1718
|
-
// order to prevent against new redemption requests hitting
|
|
1719
|
-
// that wallet. This also prevents against reporting a fraud
|
|
1720
|
-
// multiple times for one transaction (see point 3) and blocks
|
|
1721
|
-
// submission of sweep and redemption proofs. `Terminated` wallet
|
|
1722
|
-
// is blocked in the Bridge forever. If the fraud was a mistake
|
|
1723
|
-
// done by the wallet and the wallet is still honest deep in its
|
|
1724
|
-
// heart, the wallet can coordinate off-chain to recover the BTC
|
|
1725
|
-
// and donate it to another wallet. If they recover all of the
|
|
1726
|
-
// remaining BTC, DAO might decide to reward them with tokens so
|
|
1727
|
-
// that they can have at least some portion of their slashed
|
|
1728
|
-
// tokens back.
|
|
1695
|
+
// 8. Call `wallets.notifyRedemptionTimedOut` to propagate timeout
|
|
1696
|
+
// consequences to the wallet.
|
|
1729
1697
|
}
|
|
@@ -41,10 +41,9 @@ library Wallets {
|
|
|
41
41
|
// The maximum BTC threshold in satoshi that is used to decide about
|
|
42
42
|
// wallet creation.
|
|
43
43
|
uint64 maxBtcBalance;
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
|
|
47
|
-
//
|
|
44
|
+
// The maximum age of a wallet in seconds, after which the wallet
|
|
45
|
+
// moving funds process can be requested.
|
|
46
|
+
uint32 maxAge;
|
|
48
47
|
// 20-byte wallet public key hash being reference to the currently
|
|
49
48
|
// active wallet. Can be unset to the zero value under certain
|
|
50
49
|
// circumstances.
|
|
@@ -91,6 +90,9 @@ library Wallets {
|
|
|
91
90
|
uint64 pendingRedemptionsValue;
|
|
92
91
|
// UNIX timestamp the wallet was created at.
|
|
93
92
|
uint32 createdAt;
|
|
93
|
+
// UNIX timestamp indicating the moment the wallet was requested to
|
|
94
|
+
// move their funds.
|
|
95
|
+
uint32 moveFundsRequestedAt;
|
|
94
96
|
// Current state of the wallet.
|
|
95
97
|
WalletState state;
|
|
96
98
|
}
|
|
@@ -102,6 +104,8 @@ library Wallets {
|
|
|
102
104
|
uint64 newMaxBtcBalance
|
|
103
105
|
);
|
|
104
106
|
|
|
107
|
+
event WalletMaxAgeUpdated(uint32 newMaxAge);
|
|
108
|
+
|
|
105
109
|
event NewWalletRequested();
|
|
106
110
|
|
|
107
111
|
event NewWalletRegistered(
|
|
@@ -109,6 +113,16 @@ library Wallets {
|
|
|
109
113
|
bytes20 indexed walletPubKeyHash
|
|
110
114
|
);
|
|
111
115
|
|
|
116
|
+
event WalletMovingFunds(
|
|
117
|
+
bytes32 indexed ecdsaWalletID,
|
|
118
|
+
bytes20 indexed walletPubKeyHash
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
event WalletClosed(
|
|
122
|
+
bytes32 indexed ecdsaWalletID,
|
|
123
|
+
bytes20 indexed walletPubKeyHash
|
|
124
|
+
);
|
|
125
|
+
|
|
112
126
|
event WalletTerminated(
|
|
113
127
|
bytes32 indexed ecdsaWalletID,
|
|
114
128
|
bytes20 indexed walletPubKeyHash
|
|
@@ -164,6 +178,14 @@ library Wallets {
|
|
|
164
178
|
emit WalletBtcBalanceRangeUpdated(minBtcBalance, maxBtcBalance);
|
|
165
179
|
}
|
|
166
180
|
|
|
181
|
+
/// @notice Sets the wallet maximum age.
|
|
182
|
+
/// @param maxAge New value of the wallet maximum age
|
|
183
|
+
function setMaxAge(Data storage self, uint32 maxAge) external {
|
|
184
|
+
self.maxAge = maxAge;
|
|
185
|
+
|
|
186
|
+
emit WalletMaxAgeUpdated(maxAge);
|
|
187
|
+
}
|
|
188
|
+
|
|
167
189
|
/// @notice Requests creation of a new wallet. This function just
|
|
168
190
|
/// forms a request and the creation process is performed
|
|
169
191
|
/// asynchronously. Outcome of that process should be delivered
|
|
@@ -305,6 +327,152 @@ library Wallets {
|
|
|
305
327
|
emit NewWalletRegistered(ecdsaWalletID, walletPubKeyHash);
|
|
306
328
|
}
|
|
307
329
|
|
|
330
|
+
/// @notice Handles a notification about a wallet heartbeat failure and
|
|
331
|
+
/// triggers the wallet moving funds process.
|
|
332
|
+
/// @param publicKeyX Wallet's public key's X coordinate.
|
|
333
|
+
/// @param publicKeyY Wallet's public key's Y coordinate.
|
|
334
|
+
/// @dev Requirements:
|
|
335
|
+
/// - The only caller authorized to call this function is `registry`
|
|
336
|
+
/// - Wallet must be in Live state
|
|
337
|
+
function notifyWalletHeartbeatFailed(
|
|
338
|
+
Data storage self,
|
|
339
|
+
bytes32 publicKeyX,
|
|
340
|
+
bytes32 publicKeyY
|
|
341
|
+
) external {
|
|
342
|
+
require(
|
|
343
|
+
msg.sender == address(self.registry),
|
|
344
|
+
"Caller is not the ECDSA Wallet Registry"
|
|
345
|
+
);
|
|
346
|
+
|
|
347
|
+
// Compress wallet's public key and calculate Bitcoin's hash160 of it.
|
|
348
|
+
bytes20 walletPubKeyHash = bytes20(
|
|
349
|
+
EcdsaLib.compressPublicKey(publicKeyX, publicKeyY).hash160()
|
|
350
|
+
);
|
|
351
|
+
|
|
352
|
+
require(
|
|
353
|
+
self.registeredWallets[walletPubKeyHash].state == WalletState.Live,
|
|
354
|
+
"ECDSA wallet must be in Live state"
|
|
355
|
+
);
|
|
356
|
+
|
|
357
|
+
moveFunds(self, walletPubKeyHash);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/// @notice Handles a notification about a wallet redemption timeout
|
|
361
|
+
/// and requests slashing of the wallet operators. Triggers the
|
|
362
|
+
/// wallet moving funds process only if the wallet is still in the
|
|
363
|
+
/// Live state. That means multiple action timeouts can be reported
|
|
364
|
+
/// for the same wallet but only the first report requests the
|
|
365
|
+
/// wallet to move their funds.
|
|
366
|
+
/// @param walletPubKeyHash 20-byte public key hash of the wallet
|
|
367
|
+
/// @dev Requirements:
|
|
368
|
+
/// - Wallet must be in Live or MovingFunds state
|
|
369
|
+
function notifyRedemptionTimedOut(
|
|
370
|
+
Data storage self,
|
|
371
|
+
bytes20 walletPubKeyHash
|
|
372
|
+
) external {
|
|
373
|
+
WalletState walletState = self
|
|
374
|
+
.registeredWallets[walletPubKeyHash]
|
|
375
|
+
.state;
|
|
376
|
+
|
|
377
|
+
require(
|
|
378
|
+
walletState == WalletState.Live ||
|
|
379
|
+
walletState == WalletState.MovingFunds,
|
|
380
|
+
"ECDSA wallet must be in Live or MovingFunds state"
|
|
381
|
+
);
|
|
382
|
+
|
|
383
|
+
if (walletState == WalletState.Live) {
|
|
384
|
+
moveFunds(self, walletPubKeyHash);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
// TODO: Perform slashing of wallet operators.
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/// @notice Notifies that the wallet is either old enough or has too few
|
|
391
|
+
/// satoshis left and qualifies to be closed.
|
|
392
|
+
/// @param walletPubKeyHash 20-byte public key hash of the wallet
|
|
393
|
+
/// @param walletMainUtxo Data of the wallet's main UTXO, as currently
|
|
394
|
+
/// known on the Ethereum chain.
|
|
395
|
+
/// @dev Requirements:
|
|
396
|
+
/// - Wallet must not be set as the current active wallet
|
|
397
|
+
/// - Wallet must exceed the wallet maximum age OR the wallet BTC
|
|
398
|
+
/// balance must be lesser than the minimum threshold. If the latter
|
|
399
|
+
/// case is true, the `walletMainUtxo` components must point to the
|
|
400
|
+
/// recent main UTXO of the given wallet, as currently known on the
|
|
401
|
+
/// Ethereum chain. If the wallet has no main UTXO, this parameter
|
|
402
|
+
/// can be empty as it is ignored since the wallet balance is
|
|
403
|
+
/// assumed to be zero.
|
|
404
|
+
/// - Wallet must be in Live state
|
|
405
|
+
function notifyCloseableWallet(
|
|
406
|
+
Data storage self,
|
|
407
|
+
bytes20 walletPubKeyHash,
|
|
408
|
+
BitcoinTx.UTXO calldata walletMainUtxo
|
|
409
|
+
) external {
|
|
410
|
+
require(
|
|
411
|
+
self.activeWalletPubKeyHash != walletPubKeyHash,
|
|
412
|
+
"Active wallet cannot be considered closeable"
|
|
413
|
+
);
|
|
414
|
+
|
|
415
|
+
Wallet storage wallet = self.registeredWallets[walletPubKeyHash];
|
|
416
|
+
require(
|
|
417
|
+
wallet.state == WalletState.Live,
|
|
418
|
+
"ECDSA wallet must be in Live state"
|
|
419
|
+
);
|
|
420
|
+
|
|
421
|
+
/* solhint-disable-next-line not-rely-on-time */
|
|
422
|
+
bool walletOldEnough = block.timestamp >=
|
|
423
|
+
wallet.createdAt + self.maxAge;
|
|
424
|
+
|
|
425
|
+
require(
|
|
426
|
+
walletOldEnough ||
|
|
427
|
+
getWalletBtcBalance(self, walletPubKeyHash, walletMainUtxo) <
|
|
428
|
+
self.minBtcBalance,
|
|
429
|
+
"Wallet needs to be old enough or have too few satoshis"
|
|
430
|
+
);
|
|
431
|
+
|
|
432
|
+
moveFunds(self, walletPubKeyHash);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/// @notice Requests a wallet to move their funds. If the wallet balance
|
|
436
|
+
/// is zero, the wallet is closed immediately and the ECDSA
|
|
437
|
+
/// registry is notified about this fact. If the move funds
|
|
438
|
+
/// request refers to the current active wallet, such a wallet
|
|
439
|
+
/// is no longer considered active and the active wallet slot
|
|
440
|
+
/// is unset allowing to trigger a new wallet creation immediately.
|
|
441
|
+
/// @param walletPubKeyHash 20-byte public key hash of the wallet
|
|
442
|
+
/// @dev Requirements:
|
|
443
|
+
/// - The caller must make sure that the wallet is in the Live state
|
|
444
|
+
function moveFunds(Data storage self, bytes20 walletPubKeyHash) internal {
|
|
445
|
+
Wallet storage wallet = self.registeredWallets[walletPubKeyHash];
|
|
446
|
+
|
|
447
|
+
if (wallet.mainUtxoHash == bytes32(0)) {
|
|
448
|
+
// If the wallet has no main UTXO, that means its BTC balance
|
|
449
|
+
// is zero and it should be closed immediately.
|
|
450
|
+
wallet.state = WalletState.Closed;
|
|
451
|
+
|
|
452
|
+
emit WalletClosed(wallet.ecdsaWalletID, walletPubKeyHash);
|
|
453
|
+
|
|
454
|
+
self.registry.closeWallet(wallet.ecdsaWalletID);
|
|
455
|
+
} else {
|
|
456
|
+
// Otherwise, initialize the moving funds process.
|
|
457
|
+
wallet.state = WalletState.MovingFunds;
|
|
458
|
+
/* solhint-disable-next-line not-rely-on-time */
|
|
459
|
+
wallet.moveFundsRequestedAt = uint32(block.timestamp);
|
|
460
|
+
|
|
461
|
+
emit WalletMovingFunds(wallet.ecdsaWalletID, walletPubKeyHash);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
if (self.activeWalletPubKeyHash == walletPubKeyHash) {
|
|
465
|
+
// If the move funds request refers to the current active wallet,
|
|
466
|
+
// unset the active wallet and make the wallet creation process
|
|
467
|
+
// possible in order to get a new healthy active wallet.
|
|
468
|
+
delete self.activeWalletPubKeyHash;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
// TODO: Implement functions that will be called upon moving funds process
|
|
473
|
+
// end. Remember the moving funds process ends up with a successful
|
|
474
|
+
// proof or a timeout.
|
|
475
|
+
|
|
308
476
|
/// @notice Reports about a fraud committed by the given wallet. This
|
|
309
477
|
/// function performs slashing and wallet termination in reaction
|
|
310
478
|
/// to a proven fraud and it should only be called when the fraud
|