@keep-network/tbtc-v2 0.1.1-dev.8 → 0.1.1-dev.82

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 (112) hide show
  1. package/README.adoc +12 -0
  2. package/artifacts/Bank.json +817 -0
  3. package/artifacts/Bridge.json +2644 -0
  4. package/artifacts/Deposit.json +117 -0
  5. package/artifacts/DepositSweep.json +77 -0
  6. package/artifacts/EcdsaDkgValidator.json +532 -0
  7. package/artifacts/EcdsaInactivity.json +156 -0
  8. package/artifacts/EcdsaSortitionPool.json +1004 -0
  9. package/artifacts/Fraud.json +164 -0
  10. package/artifacts/KeepRegistry.json +99 -0
  11. package/artifacts/KeepStake.json +286 -0
  12. package/artifacts/KeepToken.json +711 -0
  13. package/artifacts/KeepTokenStaking.json +483 -0
  14. package/artifacts/MovingFunds.json +249 -0
  15. package/artifacts/NuCypherStakingEscrow.json +256 -0
  16. package/artifacts/NuCypherToken.json +711 -0
  17. package/artifacts/RandomBeaconStub.json +141 -0
  18. package/artifacts/Redemption.json +162 -0
  19. package/artifacts/ReimbursementPool.json +509 -0
  20. package/artifacts/Relay.json +123 -0
  21. package/artifacts/T.json +1148 -0
  22. package/artifacts/TBTC.json +27 -26
  23. package/artifacts/TBTCToken.json +27 -26
  24. package/artifacts/TBTCVault.json +462 -0
  25. package/artifacts/TokenStaking.json +2288 -0
  26. package/artifacts/TokenholderGovernor.json +1795 -0
  27. package/artifacts/TokenholderTimelock.json +1058 -0
  28. package/artifacts/VendingMachine.json +30 -29
  29. package/artifacts/VendingMachineKeep.json +400 -0
  30. package/artifacts/VendingMachineNuCypher.json +400 -0
  31. package/artifacts/WalletRegistry.json +1843 -0
  32. package/artifacts/WalletRegistryGovernance.json +2754 -0
  33. package/artifacts/Wallets.json +186 -0
  34. package/artifacts/solcInputs/5cd0a97e230d515eacf46fb60ea8963a.json +311 -0
  35. package/build/contracts/GovernanceUtils.sol/GovernanceUtils.dbg.json +1 -1
  36. package/build/contracts/GovernanceUtils.sol/GovernanceUtils.json +2 -2
  37. package/build/contracts/bank/Bank.sol/Bank.dbg.json +1 -1
  38. package/build/contracts/bank/Bank.sol/Bank.json +27 -4
  39. package/build/contracts/bank/IReceiveBalanceApproval.sol/IReceiveBalanceApproval.dbg.json +4 -0
  40. package/build/contracts/bank/IReceiveBalanceApproval.sol/IReceiveBalanceApproval.json +34 -0
  41. package/build/contracts/bridge/BitcoinTx.sol/BitcoinTx.dbg.json +1 -1
  42. package/build/contracts/bridge/BitcoinTx.sol/BitcoinTx.json +2 -2
  43. package/build/contracts/bridge/Bridge.sol/Bridge.dbg.json +1 -1
  44. package/build/contracts/bridge/Bridge.sol/Bridge.json +2516 -196
  45. package/build/contracts/bridge/BridgeState.sol/BridgeState.dbg.json +4 -0
  46. package/build/contracts/bridge/BridgeState.sol/BridgeState.json +226 -0
  47. package/build/contracts/bridge/Deposit.sol/Deposit.dbg.json +4 -0
  48. package/build/contracts/bridge/Deposit.sol/Deposit.json +72 -0
  49. package/build/contracts/bridge/DepositSweep.sol/DepositSweep.dbg.json +4 -0
  50. package/build/contracts/bridge/DepositSweep.sol/DepositSweep.json +30 -0
  51. package/build/contracts/bridge/EcdsaLib.sol/EcdsaLib.dbg.json +4 -0
  52. package/build/contracts/bridge/EcdsaLib.sol/EcdsaLib.json +10 -0
  53. package/build/contracts/bridge/Fraud.sol/Fraud.dbg.json +4 -0
  54. package/build/contracts/bridge/Fraud.sol/Fraud.json +86 -0
  55. package/build/contracts/bridge/Heartbeat.sol/Heartbeat.dbg.json +4 -0
  56. package/build/contracts/bridge/Heartbeat.sol/Heartbeat.json +10 -0
  57. package/build/contracts/bridge/IRelay.sol/IRelay.dbg.json +4 -0
  58. package/build/contracts/bridge/IRelay.sol/IRelay.json +37 -0
  59. package/build/contracts/bridge/MovingFunds.sol/MovingFunds.dbg.json +4 -0
  60. package/build/contracts/bridge/MovingFunds.sol/MovingFunds.json +138 -0
  61. package/build/contracts/bridge/Redemption.sol/OutboundTx.dbg.json +4 -0
  62. package/build/contracts/bridge/Redemption.sol/OutboundTx.json +10 -0
  63. package/build/contracts/bridge/Redemption.sol/Redemption.dbg.json +4 -0
  64. package/build/contracts/bridge/Redemption.sol/Redemption.json +92 -0
  65. package/build/contracts/bridge/VendingMachine.sol/VendingMachine.dbg.json +1 -1
  66. package/build/contracts/bridge/VendingMachine.sol/VendingMachine.json +2 -2
  67. package/build/contracts/bridge/Wallets.sol/Wallets.dbg.json +4 -0
  68. package/build/contracts/bridge/Wallets.sol/Wallets.json +112 -0
  69. package/build/contracts/token/TBTC.sol/TBTC.dbg.json +1 -1
  70. package/build/contracts/token/TBTC.sol/TBTC.json +2 -2
  71. package/build/contracts/vault/DonationVault.sol/DonationVault.dbg.json +4 -0
  72. package/build/contracts/vault/DonationVault.sol/DonationVault.json +108 -0
  73. package/build/contracts/vault/IVault.sol/IVault.dbg.json +1 -1
  74. package/build/contracts/vault/IVault.sol/IVault.json +24 -1
  75. package/build/contracts/vault/TBTCVault.sol/TBTCVault.dbg.json +1 -1
  76. package/build/contracts/vault/TBTCVault.sol/TBTCVault.json +137 -18
  77. package/contracts/GovernanceUtils.sol +4 -4
  78. package/contracts/bank/Bank.sol +119 -57
  79. package/contracts/bank/IReceiveBalanceApproval.sol +45 -0
  80. package/contracts/bridge/BitcoinTx.sol +232 -10
  81. package/contracts/bridge/Bridge.sol +1601 -244
  82. package/contracts/bridge/BridgeState.sol +739 -0
  83. package/contracts/bridge/Deposit.sol +269 -0
  84. package/contracts/bridge/DepositSweep.sol +571 -0
  85. package/contracts/bridge/EcdsaLib.sol +45 -0
  86. package/contracts/bridge/Fraud.sol +604 -0
  87. package/contracts/bridge/Heartbeat.sol +112 -0
  88. package/contracts/bridge/IRelay.sol +28 -0
  89. package/contracts/bridge/MovingFunds.sol +1089 -0
  90. package/contracts/bridge/Redemption.sol +867 -0
  91. package/contracts/bridge/VendingMachine.sol +1 -1
  92. package/contracts/bridge/Wallets.sol +553 -0
  93. package/contracts/hardhat-dependency-compiler/.hardhat-dependency-compiler +1 -0
  94. package/contracts/hardhat-dependency-compiler/@keep-network/ecdsa/contracts/WalletRegistry.sol +3 -0
  95. package/contracts/hardhat-dependency-compiler/@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol +3 -0
  96. package/contracts/hardhat-dependency-compiler/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol +3 -0
  97. package/contracts/token/TBTC.sol +1 -1
  98. package/contracts/vault/DonationVault.sol +125 -0
  99. package/contracts/vault/IVault.sol +19 -13
  100. package/contracts/vault/TBTCVault.sol +69 -19
  101. package/deploy/00_resolve_relay.ts +28 -0
  102. package/deploy/04_deploy_bank.ts +27 -0
  103. package/deploy/05_deploy_bridge.ts +80 -0
  104. package/deploy/06_deploy_tbtc_vault.ts +30 -0
  105. package/deploy/07_bank_update_bridge.ts +19 -0
  106. package/deploy/08_transfer_ownership.ts +15 -0
  107. package/deploy/09_transfer_governance.ts +20 -0
  108. package/deploy/10_transfer_proxy_admin_ownership.ts +30 -0
  109. package/deploy/11_deploy_proxy_admin_with_deputy.ts +33 -0
  110. package/export.json +15993 -475
  111. package/package.json +32 -25
  112. package/artifacts/solcInputs/4cf328e09411ac69d75a3c381680bc2c.json +0 -128
@@ -19,6 +19,25 @@
19
19
  "stateMutability": "nonpayable",
20
20
  "type": "constructor"
21
21
  },
22
+ {
23
+ "anonymous": false,
24
+ "inputs": [
25
+ {
26
+ "indexed": false,
27
+ "internalType": "address",
28
+ "name": "oldGovernance",
29
+ "type": "address"
30
+ },
31
+ {
32
+ "indexed": false,
33
+ "internalType": "address",
34
+ "name": "newGovernance",
35
+ "type": "address"
36
+ }
37
+ ],
38
+ "name": "GovernanceTransferred",
39
+ "type": "event"
40
+ },
22
41
  {
23
42
  "anonymous": false,
24
43
  "inputs": [
@@ -54,7 +73,7 @@
54
73
  "type": "uint256"
55
74
  }
56
75
  ],
57
- "name": "Redeemed",
76
+ "name": "Unminted",
58
77
  "type": "event"
59
78
  },
60
79
  {
@@ -70,6 +89,19 @@
70
89
  "stateMutability": "view",
71
90
  "type": "function"
72
91
  },
92
+ {
93
+ "inputs": [],
94
+ "name": "governance",
95
+ "outputs": [
96
+ {
97
+ "internalType": "address",
98
+ "name": "",
99
+ "type": "address"
100
+ }
101
+ ],
102
+ "stateMutability": "view",
103
+ "type": "function"
104
+ },
73
105
  {
74
106
  "inputs": [
75
107
  {
@@ -86,17 +118,27 @@
86
118
  {
87
119
  "inputs": [
88
120
  {
89
- "internalType": "address[]",
90
- "name": "depositors",
91
- "type": "address[]"
121
+ "internalType": "address",
122
+ "name": "from",
123
+ "type": "address"
92
124
  },
93
125
  {
94
- "internalType": "uint256[]",
95
- "name": "depositedAmounts",
96
- "type": "uint256[]"
126
+ "internalType": "uint256",
127
+ "name": "amount",
128
+ "type": "uint256"
129
+ },
130
+ {
131
+ "internalType": "address",
132
+ "name": "token",
133
+ "type": "address"
134
+ },
135
+ {
136
+ "internalType": "bytes",
137
+ "name": "",
138
+ "type": "bytes"
97
139
  }
98
140
  ],
99
- "name": "onBalanceIncreased",
141
+ "name": "receiveApproval",
100
142
  "outputs": [],
101
143
  "stateMutability": "nonpayable",
102
144
  "type": "function"
@@ -105,7 +147,7 @@
105
147
  "inputs": [
106
148
  {
107
149
  "internalType": "address",
108
- "name": "from",
150
+ "name": "owner",
109
151
  "type": "address"
110
152
  },
111
153
  {
@@ -113,31 +155,82 @@
113
155
  "name": "amount",
114
156
  "type": "uint256"
115
157
  },
116
- {
117
- "internalType": "address",
118
- "name": "token",
119
- "type": "address"
120
- },
121
158
  {
122
159
  "internalType": "bytes",
123
160
  "name": "",
124
161
  "type": "bytes"
125
162
  }
126
163
  ],
127
- "name": "receiveApproval",
164
+ "name": "receiveBalanceApproval",
128
165
  "outputs": [],
129
166
  "stateMutability": "nonpayable",
130
167
  "type": "function"
131
168
  },
132
169
  {
133
170
  "inputs": [
171
+ {
172
+ "internalType": "address[]",
173
+ "name": "depositors",
174
+ "type": "address[]"
175
+ },
176
+ {
177
+ "internalType": "uint256[]",
178
+ "name": "depositedAmounts",
179
+ "type": "uint256[]"
180
+ }
181
+ ],
182
+ "name": "receiveBalanceIncrease",
183
+ "outputs": [],
184
+ "stateMutability": "nonpayable",
185
+ "type": "function"
186
+ },
187
+ {
188
+ "inputs": [
189
+ {
190
+ "internalType": "contract IERC20",
191
+ "name": "token",
192
+ "type": "address"
193
+ },
194
+ {
195
+ "internalType": "address",
196
+ "name": "recipient",
197
+ "type": "address"
198
+ },
134
199
  {
135
200
  "internalType": "uint256",
136
201
  "name": "amount",
137
202
  "type": "uint256"
138
203
  }
139
204
  ],
140
- "name": "redeem",
205
+ "name": "recoverERC20",
206
+ "outputs": [],
207
+ "stateMutability": "nonpayable",
208
+ "type": "function"
209
+ },
210
+ {
211
+ "inputs": [
212
+ {
213
+ "internalType": "contract IERC721",
214
+ "name": "token",
215
+ "type": "address"
216
+ },
217
+ {
218
+ "internalType": "address",
219
+ "name": "recipient",
220
+ "type": "address"
221
+ },
222
+ {
223
+ "internalType": "uint256",
224
+ "name": "tokenId",
225
+ "type": "uint256"
226
+ },
227
+ {
228
+ "internalType": "bytes",
229
+ "name": "data",
230
+ "type": "bytes"
231
+ }
232
+ ],
233
+ "name": "recoverERC721",
141
234
  "outputs": [],
142
235
  "stateMutability": "nonpayable",
143
236
  "type": "function"
@@ -154,10 +247,36 @@
154
247
  ],
155
248
  "stateMutability": "view",
156
249
  "type": "function"
250
+ },
251
+ {
252
+ "inputs": [
253
+ {
254
+ "internalType": "address",
255
+ "name": "newGovernance",
256
+ "type": "address"
257
+ }
258
+ ],
259
+ "name": "transferGovernance",
260
+ "outputs": [],
261
+ "stateMutability": "nonpayable",
262
+ "type": "function"
263
+ },
264
+ {
265
+ "inputs": [
266
+ {
267
+ "internalType": "uint256",
268
+ "name": "amount",
269
+ "type": "uint256"
270
+ }
271
+ ],
272
+ "name": "unmint",
273
+ "outputs": [],
274
+ "stateMutability": "nonpayable",
275
+ "type": "function"
157
276
  }
158
277
  ],
159
- "bytecode": "0x60806040523480156200001157600080fd5b5060405162001300380380620013008339818101604052810190620000379190620001d4565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415620000aa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620000a19062000285565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156200011d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620001149062000263565b60405180910390fd5b816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050620003c0565b600081519050620001b7816200038c565b92915050565b600081519050620001ce81620003a6565b92915050565b60008060408385031215620001e857600080fd5b6000620001f885828601620001a6565b92505060206200020b85828601620001bd565b9150509250929050565b600062000224602683620002a7565b9150620002318262000314565b604082019050919050565b60006200024b602083620002a7565b9150620002588262000363565b602082019050919050565b600060208201905081810360008301526200027e8162000215565b9050919050565b60006020820190508181036000830152620002a0816200023c565b9050919050565b600082825260208201905092915050565b6000620002c582620002f4565b9050919050565b6000620002d982620002b8565b9050919050565b6000620002ed82620002b8565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b7f5442544320746f6b656e2063616e206e6f7420626520746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f42616e6b2063616e206e6f7420626520746865207a65726f2061646472657373600082015250565b6200039781620002cc565b8114620003a357600080fd5b50565b620003b181620002e0565b8114620003bd57600080fd5b50565b610f3080620003d06000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c806376cdb03b146100675780638f4ffcb114610085578063a0712d68146100a1578063ad7581e1146100bd578063db006a75146100d9578063e5d3d714146100f5575b600080fd5b61006f610113565b60405161007c9190610bdb565b60405180910390f35b61009f600480360381019061009a919061092e565b610137565b005b6100bb60048036038101906100b69190610a23565b610246565b005b6100d760048036038101906100d291906109ae565b6103d3565b005b6100f360048036038101906100ee9190610a23565b610566565b005b6100fd610573565b60405161010a9190610bf6565b60405180910390f35b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146101c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101be90610c31565b60405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610235576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161022c90610c11565b60405180910390fd5b61023f8585610599565b5050505050565b60003390508160008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff1660e01b81526004016102a59190610b60565b60206040518083038186803b1580156102bd57600080fd5b505afa1580156102d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f59190610a4c565b1015610336576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161032d90610c91565b60405180910390fd5b6103408183610707565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637c6db49c8230856040518463ffffffff1660e01b815260040161039d93929190610b7b565b600060405180830381600087803b1580156103b757600080fd5b505af11580156103cb573d6000803e3d6000fd5b505050505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610461576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161045890610c51565b60405180910390fd5b60008484905014156104a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161049f90610c71565b60405180910390fd5b60005b8484905081101561055f5761054c8585838181106104f2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90506020020160208101906105079190610905565b848484818110610540577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90506020020135610707565b808061055790610d61565b9150506104ab565b5050505050565b6105703382610599565b50565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b8173ffffffffffffffffffffffffffffffffffffffff167f4896181ff8f4543cc00db9fe9b6fb7e6f032b7eb772c72ab1ec1b4d2e03b9369826040516105df9190610cb1565b60405180910390a2600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166379cc679083836040518363ffffffff1660e01b8152600401610644929190610bb2565b600060405180830381600087803b15801561065e57600080fd5b505af1158015610672573d6000803e3d6000fd5b5050505060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166356a6d9ef83836040518363ffffffff1660e01b81526004016106d1929190610bb2565b600060405180830381600087803b1580156106eb57600080fd5b505af11580156106ff573d6000803e3d6000fd5b505050505050565b8173ffffffffffffffffffffffffffffffffffffffff167f30385c845b448a36257a6a1716e6ad2e1bc2cbe333cde1e69fe849ad6511adfe8260405161074d9190610cb1565b60405180910390a2600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f1983836040518363ffffffff1660e01b81526004016107b2929190610bb2565b600060405180830381600087803b1580156107cc57600080fd5b505af11580156107e0573d6000803e3d6000fd5b505050505050565b6000813590506107f781610ecc565b92915050565b60008083601f84011261080f57600080fd5b8235905067ffffffffffffffff81111561082857600080fd5b60208301915083602082028301111561084057600080fd5b9250929050565b60008083601f84011261085957600080fd5b8235905067ffffffffffffffff81111561087257600080fd5b60208301915083602082028301111561088a57600080fd5b9250929050565b60008083601f8401126108a357600080fd5b8235905067ffffffffffffffff8111156108bc57600080fd5b6020830191508360018202830111156108d457600080fd5b9250929050565b6000813590506108ea81610ee3565b92915050565b6000815190506108ff81610ee3565b92915050565b60006020828403121561091757600080fd5b6000610925848285016107e8565b91505092915050565b60008060008060006080868803121561094657600080fd5b6000610954888289016107e8565b9550506020610965888289016108db565b9450506040610976888289016107e8565b935050606086013567ffffffffffffffff81111561099357600080fd5b61099f88828901610891565b92509250509295509295909350565b600080600080604085870312156109c457600080fd5b600085013567ffffffffffffffff8111156109de57600080fd5b6109ea878288016107fd565b9450945050602085013567ffffffffffffffff811115610a0957600080fd5b610a1587828801610847565b925092505092959194509250565b600060208284031215610a3557600080fd5b6000610a43848285016108db565b91505092915050565b600060208284031215610a5e57600080fd5b6000610a6c848285016108f0565b91505092915050565b610a7e81610cdd565b82525050565b610a8d81610d19565b82525050565b610a9c81610d3d565b82525050565b6000610aaf601883610ccc565b9150610aba82610dd9565b602082019050919050565b6000610ad2601183610ccc565b9150610add82610e02565b602082019050919050565b6000610af5601683610ccc565b9150610b0082610e2b565b602082019050919050565b6000610b18601783610ccc565b9150610b2382610e54565b602082019050919050565b6000610b3b602283610ccc565b9150610b4682610e7d565b604082019050919050565b610b5a81610d0f565b82525050565b6000602082019050610b756000830184610a75565b92915050565b6000606082019050610b906000830186610a75565b610b9d6020830185610a75565b610baa6040830184610b51565b949350505050565b6000604082019050610bc76000830185610a75565b610bd46020830184610b51565b9392505050565b6000602082019050610bf06000830184610a84565b92915050565b6000602082019050610c0b6000830184610a93565b92915050565b60006020820190508181036000830152610c2a81610aa2565b9050919050565b60006020820190508181036000830152610c4a81610ac5565b9050919050565b60006020820190508181036000830152610c6a81610ae8565b9050919050565b60006020820190508181036000830152610c8a81610b0b565b9050919050565b60006020820190508181036000830152610caa81610b2e565b9050919050565b6000602082019050610cc66000830184610b51565b92915050565b600082825260208201905092915050565b6000610ce882610cef565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000610d2482610d2b565b9050919050565b6000610d3682610cef565b9050919050565b6000610d4882610d4f565b9050919050565b6000610d5a82610cef565b9050919050565b6000610d6c82610d0f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415610d9f57610d9e610daa565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4f6e6c7920544254432063616c6c657220616c6c6f7765640000000000000000600082015250565b7f546f6b656e206973206e6f742054425443000000000000000000000000000000600082015250565b7f43616c6c6572206973206e6f74207468652042616e6b00000000000000000000600082015250565b7f4e6f206465706f7369746f727320737065636966696564000000000000000000600082015250565b7f416d6f756e7420657863656564732062616c616e636520696e2074686520626160008201527f6e6b000000000000000000000000000000000000000000000000000000000000602082015250565b610ed581610cdd565b8114610ee057600080fd5b50565b610eec81610d0f565b8114610ef757600080fd5b5056fea26469706673582212202f0a068f7e8f74337505a425a28fbdc0bb82990dea78c1d1172b110d2c5e937464736f6c63430008040033",
160
- "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100625760003560e01c806376cdb03b146100675780638f4ffcb114610085578063a0712d68146100a1578063ad7581e1146100bd578063db006a75146100d9578063e5d3d714146100f5575b600080fd5b61006f610113565b60405161007c9190610bdb565b60405180910390f35b61009f600480360381019061009a919061092e565b610137565b005b6100bb60048036038101906100b69190610a23565b610246565b005b6100d760048036038101906100d291906109ae565b6103d3565b005b6100f360048036038101906100ee9190610a23565b610566565b005b6100fd610573565b60405161010a9190610bf6565b60405180910390f35b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146101c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101be90610c31565b60405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610235576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161022c90610c11565b60405180910390fd5b61023f8585610599565b5050505050565b60003390508160008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff1660e01b81526004016102a59190610b60565b60206040518083038186803b1580156102bd57600080fd5b505afa1580156102d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102f59190610a4c565b1015610336576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161032d90610c91565b60405180910390fd5b6103408183610707565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637c6db49c8230856040518463ffffffff1660e01b815260040161039d93929190610b7b565b600060405180830381600087803b1580156103b757600080fd5b505af11580156103cb573d6000803e3d6000fd5b505050505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610461576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161045890610c51565b60405180910390fd5b60008484905014156104a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161049f90610c71565b60405180910390fd5b60005b8484905081101561055f5761054c8585838181106104f2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90506020020160208101906105079190610905565b848484818110610540577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90506020020135610707565b808061055790610d61565b9150506104ab565b5050505050565b6105703382610599565b50565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b8173ffffffffffffffffffffffffffffffffffffffff167f4896181ff8f4543cc00db9fe9b6fb7e6f032b7eb772c72ab1ec1b4d2e03b9369826040516105df9190610cb1565b60405180910390a2600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166379cc679083836040518363ffffffff1660e01b8152600401610644929190610bb2565b600060405180830381600087803b15801561065e57600080fd5b505af1158015610672573d6000803e3d6000fd5b5050505060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166356a6d9ef83836040518363ffffffff1660e01b81526004016106d1929190610bb2565b600060405180830381600087803b1580156106eb57600080fd5b505af11580156106ff573d6000803e3d6000fd5b505050505050565b8173ffffffffffffffffffffffffffffffffffffffff167f30385c845b448a36257a6a1716e6ad2e1bc2cbe333cde1e69fe849ad6511adfe8260405161074d9190610cb1565b60405180910390a2600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f1983836040518363ffffffff1660e01b81526004016107b2929190610bb2565b600060405180830381600087803b1580156107cc57600080fd5b505af11580156107e0573d6000803e3d6000fd5b505050505050565b6000813590506107f781610ecc565b92915050565b60008083601f84011261080f57600080fd5b8235905067ffffffffffffffff81111561082857600080fd5b60208301915083602082028301111561084057600080fd5b9250929050565b60008083601f84011261085957600080fd5b8235905067ffffffffffffffff81111561087257600080fd5b60208301915083602082028301111561088a57600080fd5b9250929050565b60008083601f8401126108a357600080fd5b8235905067ffffffffffffffff8111156108bc57600080fd5b6020830191508360018202830111156108d457600080fd5b9250929050565b6000813590506108ea81610ee3565b92915050565b6000815190506108ff81610ee3565b92915050565b60006020828403121561091757600080fd5b6000610925848285016107e8565b91505092915050565b60008060008060006080868803121561094657600080fd5b6000610954888289016107e8565b9550506020610965888289016108db565b9450506040610976888289016107e8565b935050606086013567ffffffffffffffff81111561099357600080fd5b61099f88828901610891565b92509250509295509295909350565b600080600080604085870312156109c457600080fd5b600085013567ffffffffffffffff8111156109de57600080fd5b6109ea878288016107fd565b9450945050602085013567ffffffffffffffff811115610a0957600080fd5b610a1587828801610847565b925092505092959194509250565b600060208284031215610a3557600080fd5b6000610a43848285016108db565b91505092915050565b600060208284031215610a5e57600080fd5b6000610a6c848285016108f0565b91505092915050565b610a7e81610cdd565b82525050565b610a8d81610d19565b82525050565b610a9c81610d3d565b82525050565b6000610aaf601883610ccc565b9150610aba82610dd9565b602082019050919050565b6000610ad2601183610ccc565b9150610add82610e02565b602082019050919050565b6000610af5601683610ccc565b9150610b0082610e2b565b602082019050919050565b6000610b18601783610ccc565b9150610b2382610e54565b602082019050919050565b6000610b3b602283610ccc565b9150610b4682610e7d565b604082019050919050565b610b5a81610d0f565b82525050565b6000602082019050610b756000830184610a75565b92915050565b6000606082019050610b906000830186610a75565b610b9d6020830185610a75565b610baa6040830184610b51565b949350505050565b6000604082019050610bc76000830185610a75565b610bd46020830184610b51565b9392505050565b6000602082019050610bf06000830184610a84565b92915050565b6000602082019050610c0b6000830184610a93565b92915050565b60006020820190508181036000830152610c2a81610aa2565b9050919050565b60006020820190508181036000830152610c4a81610ac5565b9050919050565b60006020820190508181036000830152610c6a81610ae8565b9050919050565b60006020820190508181036000830152610c8a81610b0b565b9050919050565b60006020820190508181036000830152610caa81610b2e565b9050919050565b6000602082019050610cc66000830184610b51565b92915050565b600082825260208201905092915050565b6000610ce882610cef565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000610d2482610d2b565b9050919050565b6000610d3682610cef565b9050919050565b6000610d4882610d4f565b9050919050565b6000610d5a82610cef565b9050919050565b6000610d6c82610d0f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415610d9f57610d9e610daa565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4f6e6c7920544254432063616c6c657220616c6c6f7765640000000000000000600082015250565b7f546f6b656e206973206e6f742054425443000000000000000000000000000000600082015250565b7f43616c6c6572206973206e6f74207468652042616e6b00000000000000000000600082015250565b7f4e6f206465706f7369746f727320737065636966696564000000000000000000600082015250565b7f416d6f756e7420657863656564732062616c616e636520696e2074686520626160008201527f6e6b000000000000000000000000000000000000000000000000000000000000602082015250565b610ed581610cdd565b8114610ee057600080fd5b50565b610eec81610d0f565b8114610ef757600080fd5b5056fea26469706673582212202f0a068f7e8f74337505a425a28fbdc0bb82990dea78c1d1172b110d2c5e937464736f6c63430008040033",
278
+ "bytecode": "0x608060405234801561001057600080fd5b5060405161114638038061114683398101604081905261002f916101a8565b6001600160a01b03821661008a5760405162461bcd60e51b815260206004820181905260248201527f42616e6b2063616e206e6f7420626520746865207a65726f206164647265737360448201526064015b60405180910390fd5b6001600160a01b0381166100ef5760405162461bcd60e51b815260206004820152602660248201527f5442544320746f6b656e2063616e206e6f7420626520746865207a65726f206160448201526564647265737360d01b6064820152608401610081565b603280546001600160a01b038085166001600160a01b03199283161790925560338054928416929091169190911790556101283361012f565b50506101e2565b600080546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527f5f56bee8cffbe9a78652a74a60705edede02af10b0bbb888ca44b79a0d42ce80910160405180910390a15050565b6001600160a01b03811681146101a557600080fd5b50565b600080604083850312156101bb57600080fd5b82516101c681610190565b60208401519092506101d781610190565b809150509250929050565b610f55806101f16000396000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c806376cdb03b11610081578063d38bfff41161005b578063d38bfff414610184578063e5d3d71414610197578063fc4e51f6146101aa57600080fd5b806376cdb03b1461014b5780638f4ffcb11461015e578063a0712d681461017157600080fd5b8063475d0570116100b2578063475d0570146100f65780635aa6e6751461010957806364e779b11461013857600080fd5b80631171bda9146100ce578063461c6373146100e3575b600080fd5b6100e16100dc366004610b4f565b6101bd565b005b6100e16100f1366004610bdc565b6102a9565b6100e1610104366004610c5e565b6103bc565b60005461011c906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b6100e1610146366004610d2b565b610535565b60325461011c906001600160a01b031681565b6100e161016c366004610d86565b610542565b6100e161017f366004610d2b565b610601565b6100e1610192366004610df9565b610755565b60335461011c906001600160a01b031681565b6100e16101b8366004610e1d565b610834565b6000546001600160a01b0316331461021c5760405162461bcd60e51b815260206004820152601c60248201527f43616c6c6572206973206e6f742074686520676f7665726e616e63650000000060448201526064015b60405180910390fd5b6033546040517f1171bda90000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015284811660248301526044820184905290911690631171bda9906064015b600060405180830381600087803b15801561028c57600080fd5b505af11580156102a0573d6000803e3d6000fd5b50505050505050565b6032546001600160a01b031633146103035760405162461bcd60e51b815260206004820152601660248201527f43616c6c6572206973206e6f74207468652042616e6b000000000000000000006044820152606401610213565b826103505760405162461bcd60e51b815260206004820152601760248201527f4e6f206465706f7369746f7273207370656369666965640000000000000000006044820152606401610213565b60005b838110156103b5576103a385858381811061037057610370610e73565b90506020020160208101906103859190610df9565b84848481811061039757610397610e73565b90506020020135610918565b806103ad81610e89565b915050610353565b5050505050565b6032546001600160a01b031633146104165760405162461bcd60e51b815260206004820152601660248201527f43616c6c6572206973206e6f74207468652042616e6b000000000000000000006044820152606401610213565b6032546040516370a0823160e01b81526001600160a01b038581166004830152849216906370a082319060240160206040518083038186803b15801561045b57600080fd5b505afa15801561046f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104939190610eb2565b10156104ec5760405162461bcd60e51b815260206004820152602260248201527f416d6f756e7420657863656564732062616c616e636520696e207468652062616044820152616e6b60f01b6064820152608401610213565b6104f68383610918565b603254604051631f1b6d2760e21b81526001600160a01b0385811660048301523060248301526044820185905290911690637c6db49c90606401610272565b61053f33826109ad565b50565b6033546001600160a01b0384811691161461059f5760405162461bcd60e51b815260206004820152601160248201527f546f6b656e206973206e6f7420544254430000000000000000000000000000006044820152606401610213565b336001600160a01b038416146105f75760405162461bcd60e51b815260206004820152601860248201527f4f6e6c7920544254432063616c6c657220616c6c6f77656400000000000000006044820152606401610213565b6103b585856109ad565b6032546040516370a0823160e01b815233600482018190529183916001600160a01b03909116906370a082319060240160206040518083038186803b15801561064957600080fd5b505afa15801561065d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106819190610eb2565b10156106da5760405162461bcd60e51b815260206004820152602260248201527f416d6f756e7420657863656564732062616c616e636520696e207468652062616044820152616e6b60f01b6064820152608401610213565b6106e48183610918565b603254604051631f1b6d2760e21b81526001600160a01b0383811660048301523060248301526044820185905290911690637c6db49c906064015b600060405180830381600087803b15801561073957600080fd5b505af115801561074d573d6000803e3d6000fd5b505050505050565b6000546001600160a01b031633146107af5760405162461bcd60e51b815260206004820152601c60248201527f43616c6c6572206973206e6f742074686520676f7665726e616e6365000000006044820152606401610213565b6001600160a01b03811661082b5760405162461bcd60e51b815260206004820152602260248201527f4e657720676f7665726e616e636520697320746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610213565b61053f81610ac1565b6000546001600160a01b0316331461088e5760405162461bcd60e51b815260206004820152601c60248201527f43616c6c6572206973206e6f742074686520676f7665726e616e6365000000006044820152606401610213565b6033546040517ffc4e51f60000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063fc4e51f6906108df9088908890889088908890600401610ecb565b600060405180830381600087803b1580156108f957600080fd5b505af115801561090d573d6000803e3d6000fd5b505050505050505050565b816001600160a01b03167f30385c845b448a36257a6a1716e6ad2e1bc2cbe333cde1e69fe849ad6511adfe8260405161095391815260200190565b60405180910390a26033546040517f40c10f190000000000000000000000000000000000000000000000000000000081526001600160a01b03848116600483015260248201849052909116906340c10f199060440161071f565b816001600160a01b03167f68751a4c3821398cb63d11609eca2440742ef19446f0c0261bfa8a13dd0748b8826040516109e891815260200190565b60405180910390a26033546040517f79cc67900000000000000000000000000000000000000000000000000000000081526001600160a01b03848116600483015260248201849052909116906379cc679090604401600060405180830381600087803b158015610a5757600080fd5b505af1158015610a6b573d6000803e3d6000fd5b50506032546040517f56a6d9ef0000000000000000000000000000000000000000000000000000000081526001600160a01b0386811660048301526024820186905290911692506356a6d9ef915060440161071f565b600080546001600160a01b038381167fffffffffffffffffffffffff000000000000000000000000000000000000000083168117909355604080519190921680825260208201939093527f5f56bee8cffbe9a78652a74a60705edede02af10b0bbb888ca44b79a0d42ce80910160405180910390a15050565b6001600160a01b038116811461053f57600080fd5b600080600060608486031215610b6457600080fd5b8335610b6f81610b3a565b92506020840135610b7f81610b3a565b929592945050506040919091013590565b60008083601f840112610ba257600080fd5b50813567ffffffffffffffff811115610bba57600080fd5b6020830191508360208260051b8501011115610bd557600080fd5b9250929050565b60008060008060408587031215610bf257600080fd5b843567ffffffffffffffff80821115610c0a57600080fd5b610c1688838901610b90565b90965094506020870135915080821115610c2f57600080fd5b50610c3c87828801610b90565b95989497509550505050565b634e487b7160e01b600052604160045260246000fd5b600080600060608486031215610c7357600080fd5b8335610c7e81610b3a565b925060208401359150604084013567ffffffffffffffff80821115610ca257600080fd5b818601915086601f830112610cb657600080fd5b813581811115610cc857610cc8610c48565b604051601f8201601f19908116603f01168101908382118183101715610cf057610cf0610c48565b81604052828152896020848701011115610d0957600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b600060208284031215610d3d57600080fd5b5035919050565b60008083601f840112610d5657600080fd5b50813567ffffffffffffffff811115610d6e57600080fd5b602083019150836020828501011115610bd557600080fd5b600080600080600060808688031215610d9e57600080fd5b8535610da981610b3a565b9450602086013593506040860135610dc081610b3a565b9250606086013567ffffffffffffffff811115610ddc57600080fd5b610de888828901610d44565b969995985093965092949392505050565b600060208284031215610e0b57600080fd5b8135610e1681610b3a565b9392505050565b600080600080600060808688031215610e3557600080fd5b8535610e4081610b3a565b94506020860135610e5081610b3a565b935060408601359250606086013567ffffffffffffffff811115610ddc57600080fd5b634e487b7160e01b600052603260045260246000fd5b6000600019821415610eab57634e487b7160e01b600052601160045260246000fd5b5060010190565b600060208284031215610ec457600080fd5b5051919050565b60006001600160a01b03808816835280871660208401525084604083015260806060830152826080830152828460a0840137600060a0848401015260a0601f19601f8501168301019050969550505050505056fea26469706673582212209e4975796006d1db5a7262daa7434fa2dbff97aad3fb5e7c0afab1d02413c3fa64736f6c63430008090033",
279
+ "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100c95760003560e01c806376cdb03b11610081578063d38bfff41161005b578063d38bfff414610184578063e5d3d71414610197578063fc4e51f6146101aa57600080fd5b806376cdb03b1461014b5780638f4ffcb11461015e578063a0712d681461017157600080fd5b8063475d0570116100b2578063475d0570146100f65780635aa6e6751461010957806364e779b11461013857600080fd5b80631171bda9146100ce578063461c6373146100e3575b600080fd5b6100e16100dc366004610b4f565b6101bd565b005b6100e16100f1366004610bdc565b6102a9565b6100e1610104366004610c5e565b6103bc565b60005461011c906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b6100e1610146366004610d2b565b610535565b60325461011c906001600160a01b031681565b6100e161016c366004610d86565b610542565b6100e161017f366004610d2b565b610601565b6100e1610192366004610df9565b610755565b60335461011c906001600160a01b031681565b6100e16101b8366004610e1d565b610834565b6000546001600160a01b0316331461021c5760405162461bcd60e51b815260206004820152601c60248201527f43616c6c6572206973206e6f742074686520676f7665726e616e63650000000060448201526064015b60405180910390fd5b6033546040517f1171bda90000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015284811660248301526044820184905290911690631171bda9906064015b600060405180830381600087803b15801561028c57600080fd5b505af11580156102a0573d6000803e3d6000fd5b50505050505050565b6032546001600160a01b031633146103035760405162461bcd60e51b815260206004820152601660248201527f43616c6c6572206973206e6f74207468652042616e6b000000000000000000006044820152606401610213565b826103505760405162461bcd60e51b815260206004820152601760248201527f4e6f206465706f7369746f7273207370656369666965640000000000000000006044820152606401610213565b60005b838110156103b5576103a385858381811061037057610370610e73565b90506020020160208101906103859190610df9565b84848481811061039757610397610e73565b90506020020135610918565b806103ad81610e89565b915050610353565b5050505050565b6032546001600160a01b031633146104165760405162461bcd60e51b815260206004820152601660248201527f43616c6c6572206973206e6f74207468652042616e6b000000000000000000006044820152606401610213565b6032546040516370a0823160e01b81526001600160a01b038581166004830152849216906370a082319060240160206040518083038186803b15801561045b57600080fd5b505afa15801561046f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104939190610eb2565b10156104ec5760405162461bcd60e51b815260206004820152602260248201527f416d6f756e7420657863656564732062616c616e636520696e207468652062616044820152616e6b60f01b6064820152608401610213565b6104f68383610918565b603254604051631f1b6d2760e21b81526001600160a01b0385811660048301523060248301526044820185905290911690637c6db49c90606401610272565b61053f33826109ad565b50565b6033546001600160a01b0384811691161461059f5760405162461bcd60e51b815260206004820152601160248201527f546f6b656e206973206e6f7420544254430000000000000000000000000000006044820152606401610213565b336001600160a01b038416146105f75760405162461bcd60e51b815260206004820152601860248201527f4f6e6c7920544254432063616c6c657220616c6c6f77656400000000000000006044820152606401610213565b6103b585856109ad565b6032546040516370a0823160e01b815233600482018190529183916001600160a01b03909116906370a082319060240160206040518083038186803b15801561064957600080fd5b505afa15801561065d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106819190610eb2565b10156106da5760405162461bcd60e51b815260206004820152602260248201527f416d6f756e7420657863656564732062616c616e636520696e207468652062616044820152616e6b60f01b6064820152608401610213565b6106e48183610918565b603254604051631f1b6d2760e21b81526001600160a01b0383811660048301523060248301526044820185905290911690637c6db49c906064015b600060405180830381600087803b15801561073957600080fd5b505af115801561074d573d6000803e3d6000fd5b505050505050565b6000546001600160a01b031633146107af5760405162461bcd60e51b815260206004820152601c60248201527f43616c6c6572206973206e6f742074686520676f7665726e616e6365000000006044820152606401610213565b6001600160a01b03811661082b5760405162461bcd60e51b815260206004820152602260248201527f4e657720676f7665726e616e636520697320746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610213565b61053f81610ac1565b6000546001600160a01b0316331461088e5760405162461bcd60e51b815260206004820152601c60248201527f43616c6c6572206973206e6f742074686520676f7665726e616e6365000000006044820152606401610213565b6033546040517ffc4e51f60000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063fc4e51f6906108df9088908890889088908890600401610ecb565b600060405180830381600087803b1580156108f957600080fd5b505af115801561090d573d6000803e3d6000fd5b505050505050505050565b816001600160a01b03167f30385c845b448a36257a6a1716e6ad2e1bc2cbe333cde1e69fe849ad6511adfe8260405161095391815260200190565b60405180910390a26033546040517f40c10f190000000000000000000000000000000000000000000000000000000081526001600160a01b03848116600483015260248201849052909116906340c10f199060440161071f565b816001600160a01b03167f68751a4c3821398cb63d11609eca2440742ef19446f0c0261bfa8a13dd0748b8826040516109e891815260200190565b60405180910390a26033546040517f79cc67900000000000000000000000000000000000000000000000000000000081526001600160a01b03848116600483015260248201849052909116906379cc679090604401600060405180830381600087803b158015610a5757600080fd5b505af1158015610a6b573d6000803e3d6000fd5b50506032546040517f56a6d9ef0000000000000000000000000000000000000000000000000000000081526001600160a01b0386811660048301526024820186905290911692506356a6d9ef915060440161071f565b600080546001600160a01b038381167fffffffffffffffffffffffff000000000000000000000000000000000000000083168117909355604080519190921680825260208201939093527f5f56bee8cffbe9a78652a74a60705edede02af10b0bbb888ca44b79a0d42ce80910160405180910390a15050565b6001600160a01b038116811461053f57600080fd5b600080600060608486031215610b6457600080fd5b8335610b6f81610b3a565b92506020840135610b7f81610b3a565b929592945050506040919091013590565b60008083601f840112610ba257600080fd5b50813567ffffffffffffffff811115610bba57600080fd5b6020830191508360208260051b8501011115610bd557600080fd5b9250929050565b60008060008060408587031215610bf257600080fd5b843567ffffffffffffffff80821115610c0a57600080fd5b610c1688838901610b90565b90965094506020870135915080821115610c2f57600080fd5b50610c3c87828801610b90565b95989497509550505050565b634e487b7160e01b600052604160045260246000fd5b600080600060608486031215610c7357600080fd5b8335610c7e81610b3a565b925060208401359150604084013567ffffffffffffffff80821115610ca257600080fd5b818601915086601f830112610cb657600080fd5b813581811115610cc857610cc8610c48565b604051601f8201601f19908116603f01168101908382118183101715610cf057610cf0610c48565b81604052828152896020848701011115610d0957600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b600060208284031215610d3d57600080fd5b5035919050565b60008083601f840112610d5657600080fd5b50813567ffffffffffffffff811115610d6e57600080fd5b602083019150836020828501011115610bd557600080fd5b600080600080600060808688031215610d9e57600080fd5b8535610da981610b3a565b9450602086013593506040860135610dc081610b3a565b9250606086013567ffffffffffffffff811115610ddc57600080fd5b610de888828901610d44565b969995985093965092949392505050565b600060208284031215610e0b57600080fd5b8135610e1681610b3a565b9392505050565b600080600080600060808688031215610e3557600080fd5b8535610e4081610b3a565b94506020860135610e5081610b3a565b935060408601359250606086013567ffffffffffffffff811115610ddc57600080fd5b634e487b7160e01b600052603260045260246000fd5b6000600019821415610eab57634e487b7160e01b600052601160045260246000fd5b5060010190565b600060208284031215610ec457600080fd5b5051919050565b60006001600160a01b03808816835280871660208401525084604083015260806060830152826080830152828460a0840137600060a0848401015260a0601f19601f8501168301019050969550505050505056fea26469706673582212209e4975796006d1db5a7262daa7434fa2dbff97aad3fb5e7c0afab1d02413c3fa64736f6c63430008090033",
161
280
  "linkReferences": {},
162
281
  "deployedLinkReferences": {}
163
282
  }
@@ -1,6 +1,6 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
 
3
- pragma solidity 0.8.4;
3
+ pragma solidity ^0.8.9;
4
4
 
5
5
  library GovernanceUtils {
6
6
  /// @notice Reverts if the governance delay has not passed since
@@ -24,9 +24,9 @@ library GovernanceUtils {
24
24
  /// @notice Gets the time remaining until the governable parameter update
25
25
  /// can be committed.
26
26
  /// @param changeInitiatedTimestamp Timestamp indicating the beginning of
27
- /// the change
28
- /// @param delay Governance delay
29
- /// @return Remaining time in seconds
27
+ /// the change.
28
+ /// @param delay Governance delay.
29
+ /// @return Remaining time in seconds.
30
30
  function getRemainingGovernanceDelay(
31
31
  uint256 changeInitiatedTimestamp,
32
32
  uint256 delay
@@ -13,24 +13,25 @@
13
13
  // ▐████▌ ▐████▌
14
14
  // ▐████▌ ▐████▌
15
15
 
16
- pragma solidity 0.8.4;
16
+ pragma solidity ^0.8.9;
17
17
 
18
18
  import "@openzeppelin/contracts/access/Ownable.sol";
19
19
 
20
+ import "./IReceiveBalanceApproval.sol";
20
21
  import "../vault/IVault.sol";
21
22
 
22
23
  /// @title Bitcoin Bank
23
24
  /// @notice Bank is a central component tracking Bitcoin balances. Balances can
24
- /// be transferred between holders and holders can approve their
25
- /// balances to be spent by others. Balances in the Bank are updated for
26
- /// depositors who deposit their Bitcoin into the Bridge and only the
27
- /// Bridge can increase balances.
25
+ /// be transferred between balance owners, and balance owners can
26
+ /// approve their balances to be spent by others. Balances in the Bank
27
+ /// are updated for depositors who deposited their Bitcoin into the
28
+ /// Bridge and only the Bridge can increase balances.
28
29
  /// @dev Bank is a governable contract and the Governance can upgrade the Bridge
29
30
  /// address.
30
31
  contract Bank is Ownable {
31
32
  address public bridge;
32
33
 
33
- /// @notice The balance of a given account in the Bank. Zero by default.
34
+ /// @notice The balance of the given account in the Bank. Zero by default.
34
35
  mapping(address => uint256) public balanceOf;
35
36
 
36
37
  /// @notice The remaining amount of balance a spender will be
@@ -38,16 +39,17 @@ contract Bank is Ownable {
38
39
  /// `transferBalanceFrom`. Zero by default.
39
40
  mapping(address => mapping(address => uint256)) public allowance;
40
41
 
41
- /// @notice Returns the current nonce for EIP2612 permission for the
42
- /// provided balance owner for a replay protection. Used to
43
- /// construct EIP2612 signature provided to `permit` function.
42
+ /// @notice Returns the current nonce for an EIP2612 permission for the
43
+ /// provided balance owner to protect against replay attacks. Used
44
+ /// to construct an EIP2612 signature provided to the `permit`
45
+ /// function.
44
46
  mapping(address => uint256) public nonce;
45
47
 
46
48
  uint256 public immutable cachedChainId;
47
49
  bytes32 public immutable cachedDomainSeparator;
48
50
 
49
- /// @notice Returns EIP2612 Permit message hash. Used to construct EIP2612
50
- /// signature provided to `permit` function.
51
+ /// @notice Returns an EIP2612 Permit message hash. Used to construct
52
+ /// an EIP2612 signature provided to the `permit` function.
51
53
  bytes32 public constant PERMIT_TYPEHASH =
52
54
  keccak256(
53
55
  "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"
@@ -86,6 +88,9 @@ contract Bank is Ownable {
86
88
  /// check the status of the Bridge. The Governance implementation needs
87
89
  /// to ensure all requirements for the upgrade are satisfied before
88
90
  /// executing this function.
91
+ /// Requirements:
92
+ /// - The new Bridge address must not be zero.
93
+ /// @param _bridge The new Bridge address.
89
94
  function updateBridge(address _bridge) external onlyOwner {
90
95
  require(_bridge != address(0), "Bridge address must not be 0x0");
91
96
  bridge = _bridge;
@@ -97,25 +102,59 @@ contract Bank is Ownable {
97
102
  /// @dev Requirements:
98
103
  /// - `recipient` cannot be the zero address,
99
104
  /// - the caller must have a balance of at least `amount`.
105
+ /// @param recipient The recipient of the balance.
106
+ /// @param amount The amount of the balance transferred.
100
107
  function transferBalance(address recipient, uint256 amount) external {
101
108
  _transferBalance(msg.sender, recipient, amount);
102
109
  }
103
110
 
104
111
  /// @notice Sets `amount` as the allowance of `spender` over the caller's
105
112
  /// balance.
106
- /// @dev If the `amount` is set to `type(uint256).max` then
113
+ /// @dev If the `amount` is set to `type(uint256).max`,
107
114
  /// `transferBalanceFrom` will not reduce an allowance.
108
115
  /// Beware that changing an allowance with this function brings the
109
116
  /// risk that someone may use both the old and the new allowance by
110
117
  /// unfortunate transaction ordering. Please use
111
118
  /// `increaseBalanceAllowance` and `decreaseBalanceAllowance` to
112
119
  /// eliminate the risk.
120
+ /// @param spender The address that will be allowed to spend the balance.
121
+ /// @param amount The amount the spender is allowed to spend.
113
122
  function approveBalance(address spender, uint256 amount) external {
114
123
  _approveBalance(msg.sender, spender, amount);
115
124
  }
116
125
 
117
- /// @notice Atomically increases the balance allowance granted to `spender`
118
- /// by the caller by the given `addedValue`.
126
+ /// @notice Sets the `amount` as an allowance of a smart contract `spender`
127
+ /// over the caller's balance and calls the `spender` via
128
+ /// `receiveBalanceApproval`.
129
+ /// @dev If the `amount` is set to `type(uint256).max`, the potential
130
+ /// `transferBalanceFrom` executed in `receiveBalanceApproval` of
131
+ /// `spender` will not reduce an allowance. Beware that changing an
132
+ /// allowance with this function brings the risk that `spender` may use
133
+ /// both the old and the new allowance by unfortunate transaction
134
+ /// ordering. Please use `increaseBalanceAllowance` and
135
+ /// `decreaseBalanceAllowance` to eliminate the risk.
136
+ /// @param spender The smart contract that will be allowed to spend the
137
+ /// balance.
138
+ /// @param amount The amount the spender contract is allowed to spend.
139
+ /// @param extraData Extra data passed to the `spender` contract via
140
+ /// `receiveBalanceApproval` call.
141
+ function approveBalanceAndCall(
142
+ address spender,
143
+ uint256 amount,
144
+ bytes memory extraData
145
+ ) external {
146
+ _approveBalance(msg.sender, spender, amount);
147
+ IReceiveBalanceApproval(spender).receiveBalanceApproval(
148
+ msg.sender,
149
+ amount,
150
+ extraData
151
+ );
152
+ }
153
+
154
+ /// @notice Atomically increases the caller's balance allowance granted to
155
+ /// `spender` by the given `addedValue`.
156
+ /// @param spender The spender address for which the allowance is increased.
157
+ /// @param addedValue The amount by which the allowance is increased.
119
158
  function increaseBalanceAllowance(address spender, uint256 addedValue)
120
159
  external
121
160
  {
@@ -126,8 +165,14 @@ contract Bank is Ownable {
126
165
  );
127
166
  }
128
167
 
129
- /// @notice Atomically decreases the balance allowance granted to `spender`
130
- /// by the caller by the given `subtractedValue`.
168
+ /// @notice Atomically decreases the caller's balance allowance granted to
169
+ /// `spender` by the given `subtractedValue`.
170
+ /// @dev Requirements:
171
+ /// - `spender` must not be the zero address,
172
+ /// - the current allowance for `spender` must not be lower than
173
+ /// the `subtractedValue`.
174
+ /// @param spender The spender address for which the allowance is decreased.
175
+ /// @param subtractedValue The amount by which the allowance is decreased.
131
176
  function decreaseBalanceAllowance(address spender, uint256 subtractedValue)
132
177
  external
133
178
  {
@@ -151,8 +196,11 @@ contract Bank is Ownable {
151
196
  /// @dev Requirements:
152
197
  /// - `recipient` cannot be the zero address,
153
198
  /// - `spender` must have a balance of at least `amount`,
154
- /// - the caller must have allowance for `spender`'s balance of at
199
+ /// - the caller must have an allowance for `spender`'s balance of at
155
200
  /// least `amount`.
201
+ /// @param spender The address from which the balance is transferred.
202
+ /// @param recipient The address to which the balance is transferred.
203
+ /// @param amount The amount of balance that is transferred.
156
204
  function transferBalanceFrom(
157
205
  address spender,
158
206
  address recipient,
@@ -171,12 +219,13 @@ contract Bank is Ownable {
171
219
  _transferBalance(spender, recipient, amount);
172
220
  }
173
221
 
174
- /// @notice EIP2612 approval made with secp256k1 signature.
175
- /// Users can authorize a transfer of their balance with a signature
176
- /// conforming EIP712 standard, rather than an on-chain transaction
177
- /// from their address. Anyone can submit this signature on the
178
- /// user's behalf by calling the permit function, paying gas fees,
179
- /// and possibly performing other actions in the same transaction.
222
+ /// @notice An EIP2612 approval made with secp256k1 signature. Users can
223
+ /// authorize a transfer of their balance with a signature
224
+ /// conforming to the EIP712 standard, rather than an on-chain
225
+ /// transaction from their address. Anyone can submit this signature
226
+ /// on the user's behalf by calling the `permit` function, paying
227
+ /// gas fees, and possibly performing other actions in the same
228
+ /// transaction.
180
229
  /// @dev The deadline argument can be set to `type(uint256).max to create
181
230
  /// permits that effectively never expire. If the `amount` is set
182
231
  /// to `type(uint256).max` then `transferBalanceFrom` will not
@@ -185,6 +234,13 @@ contract Bank is Ownable {
185
234
  /// new allowance by unfortunate transaction ordering. Please use
186
235
  /// `increaseBalanceAllowance` and `decreaseBalanceAllowance` to
187
236
  /// eliminate the risk.
237
+ /// @param owner The balance owner who signed the permission.
238
+ /// @param spender The address that will be allowed to spend the balance.
239
+ /// @param amount The amount the spender is allowed to spend.
240
+ /// @param deadline The UNIX time until which the permit is valid.
241
+ /// @param v V part of the permit signature.
242
+ /// @param r R part of the permit signature.
243
+ /// @param s S part of the permit signature.
188
244
  function permit(
189
245
  address owner,
190
246
  address spender,
@@ -207,23 +263,22 @@ contract Bank is Ownable {
207
263
  );
208
264
  require(v == 27 || v == 28, "Invalid signature 'v' value");
209
265
 
210
- bytes32 digest =
211
- keccak256(
212
- abi.encodePacked(
213
- "\x19\x01",
214
- DOMAIN_SEPARATOR(),
215
- keccak256(
216
- abi.encode(
217
- PERMIT_TYPEHASH,
218
- owner,
219
- spender,
220
- amount,
221
- nonce[owner]++,
222
- deadline
223
- )
266
+ bytes32 digest = keccak256(
267
+ abi.encodePacked(
268
+ "\x19\x01",
269
+ DOMAIN_SEPARATOR(),
270
+ keccak256(
271
+ abi.encode(
272
+ PERMIT_TYPEHASH,
273
+ owner,
274
+ spender,
275
+ amount,
276
+ nonce[owner]++,
277
+ deadline
224
278
  )
225
279
  )
226
- );
280
+ )
281
+ );
227
282
  address recoveredAddress = ecrecover(digest, v, r, s);
228
283
  require(
229
284
  recoveredAddress != address(0) && recoveredAddress == owner,
@@ -235,7 +290,10 @@ contract Bank is Ownable {
235
290
  /// @notice Increases balances of the provided `recipients` by the provided
236
291
  /// `amounts`. Can only be called by the Bridge.
237
292
  /// @dev Requirements:
238
- /// - length of `recipients` and `amounts` must be the same.
293
+ /// - length of `recipients` and `amounts` must be the same,
294
+ /// - none of `recipients` addresses must point to the Bank.
295
+ /// @param recipients Balance increase recipients.
296
+ /// @param amounts Amounts by which balances are increased.
239
297
  function increaseBalances(
240
298
  address[] calldata recipients,
241
299
  uint256[] calldata amounts
@@ -251,6 +309,10 @@ contract Bank is Ownable {
251
309
 
252
310
  /// @notice Increases balance of the provided `recipient` by the provided
253
311
  /// `amount`. Can only be called by the Bridge.
312
+ /// @dev Requirements:
313
+ /// - `recipient` address must not point to the Bank.
314
+ /// @param recipient Balance increase recipient.
315
+ /// @param amount Amount by which the balance is increased.
254
316
  function increaseBalance(address recipient, uint256 amount)
255
317
  external
256
318
  onlyBridge
@@ -259,39 +321,37 @@ contract Bank is Ownable {
259
321
  }
260
322
 
261
323
  /// @notice Increases the given smart contract `vault`'s balance and
262
- /// notifies the `vault` contract. Called by the Bridge after
263
- /// the deposits routed by depositors to that `vault` have been
264
- /// swept by the Bridge. This way, the depositor does not have to
265
- /// issue a separate transaction to the `vault` contract.
324
+ /// notifies the `vault` contract about it.
266
325
  /// Can be called only by the Bridge.
267
326
  /// @dev Requirements:
268
327
  /// - `vault` must implement `IVault` interface,
269
- /// - length of `depositors` and `depositedAmounts` must be the same.
270
- /// @param vault Address of `IVault` recipient contract
271
- /// @param depositors Addresses of depositors whose deposits have been swept
272
- /// @param depositedAmounts Amounts deposited by individual depositors and
273
- /// swept. The `vault`'s balance in the Bank will be increased by the
274
- /// sum of all elements in this array.
328
+ /// - length of `recipients` and `amounts` must be the same.
329
+ /// @param vault Address of `IVault` recipient contract.
330
+ /// @param recipients Balance increase recipients.
331
+ /// @param amounts Amounts by which balances are increased.
275
332
  function increaseBalanceAndCall(
276
333
  address vault,
277
- address[] calldata depositors,
278
- uint256[] calldata depositedAmounts
334
+ address[] calldata recipients,
335
+ uint256[] calldata amounts
279
336
  ) external onlyBridge {
280
337
  require(
281
- depositors.length == depositedAmounts.length,
338
+ recipients.length == amounts.length,
282
339
  "Arrays must have the same length"
283
340
  );
284
341
  uint256 totalAmount = 0;
285
- for (uint256 i = 0; i < depositedAmounts.length; i++) {
286
- totalAmount += depositedAmounts[i];
342
+ for (uint256 i = 0; i < amounts.length; i++) {
343
+ totalAmount += amounts[i];
287
344
  }
288
345
  _increaseBalance(vault, totalAmount);
289
- IVault(vault).onBalanceIncreased(depositors, depositedAmounts);
346
+ IVault(vault).receiveBalanceIncrease(recipients, amounts);
290
347
  }
291
348
 
292
349
  /// @notice Decreases caller's balance by the provided `amount`. There is no
293
350
  /// way to restore the balance so do not call this function unless
294
351
  /// you really know what you are doing!
352
+ /// @dev Requirements:
353
+ /// - The caller must have a balance of at least `amount`.
354
+ /// @param amount The amount by which the balance is decreased.
295
355
  function decreaseBalance(uint256 amount) external {
296
356
  balanceOf[msg.sender] -= amount;
297
357
  emit BalanceDecreased(msg.sender, amount);
@@ -299,7 +359,7 @@ contract Bank is Ownable {
299
359
 
300
360
  /// @notice Returns hash of EIP712 Domain struct with `TBTC Bank` as
301
361
  /// a signing domain and Bank contract as a verifying contract.
302
- /// Used to construct EIP2612 signature provided to `permit`
362
+ /// Used to construct an EIP2612 signature provided to the `permit`
303
363
  /// function.
304
364
  /* solhint-disable-next-line func-name-mixedcase */
305
365
  function DOMAIN_SEPARATOR() public view returns (bytes32) {
@@ -342,7 +402,9 @@ contract Bank is Ownable {
342
402
 
343
403
  uint256 spenderBalance = balanceOf[spender];
344
404
  require(spenderBalance >= amount, "Transfer amount exceeds balance");
345
- unchecked {balanceOf[spender] = spenderBalance - amount;}
405
+ unchecked {
406
+ balanceOf[spender] = spenderBalance - amount;
407
+ }
346
408
  balanceOf[recipient] += amount;
347
409
  emit BalanceTransferred(spender, recipient, amount);
348
410
  }