@keep-network/tbtc-v2 0.1.1-dev.80 → 0.1.1-dev.83
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/Bank.json +94 -34
- package/artifacts/Bridge.json +33 -11
- package/artifacts/Deposit.json +7 -7
- package/artifacts/DepositSweep.json +7 -7
- package/artifacts/EcdsaDkgValidator.json +1 -1
- package/artifacts/EcdsaInactivity.json +1 -1
- package/artifacts/EcdsaSortitionPool.json +2 -2
- package/artifacts/Fraud.json +7 -7
- package/artifacts/KeepRegistry.json +1 -1
- package/artifacts/KeepStake.json +2 -2
- package/artifacts/KeepToken.json +2 -2
- package/artifacts/KeepTokenStaking.json +1 -1
- package/artifacts/MovingFunds.json +9 -9
- package/artifacts/NuCypherStakingEscrow.json +1 -1
- package/artifacts/NuCypherToken.json +2 -2
- package/artifacts/RandomBeaconStub.json +1 -1
- package/artifacts/Redemption.json +26 -14
- package/artifacts/ReimbursementPool.json +2 -2
- package/artifacts/Relay.json +9 -9
- package/artifacts/T.json +2 -2
- package/artifacts/TBTC.json +10 -10
- package/artifacts/TBTCToken.json +10 -10
- package/artifacts/TBTCVault.json +40 -40
- package/artifacts/TokenStaking.json +1 -1
- package/artifacts/TokenholderGovernor.json +9 -9
- package/artifacts/TokenholderTimelock.json +8 -8
- package/artifacts/VendingMachine.json +11 -11
- package/artifacts/VendingMachineKeep.json +1 -1
- package/artifacts/VendingMachineNuCypher.json +1 -1
- package/artifacts/WalletRegistry.json +5 -5
- package/artifacts/WalletRegistryGovernance.json +2 -2
- package/artifacts/Wallets.json +7 -7
- package/artifacts/solcInputs/{4f6d4f5cd1e3d835e20ed55926a445cd.json → 21fcfd91cc383ddf1b3799814408151d.json} +11 -8
- package/build/contracts/GovernanceUtils.sol/GovernanceUtils.dbg.json +1 -1
- package/build/contracts/bank/Bank.sol/Bank.dbg.json +1 -1
- package/build/contracts/bank/Bank.sol/Bank.json +4 -4
- package/build/contracts/bank/IReceiveBalanceApproval.sol/IReceiveBalanceApproval.dbg.json +1 -1
- package/build/contracts/bridge/BitcoinTx.sol/BitcoinTx.dbg.json +1 -1
- package/build/contracts/bridge/BitcoinTx.sol/BitcoinTx.json +2 -2
- package/build/contracts/bridge/Bridge.sol/Bridge.dbg.json +1 -1
- package/build/contracts/bridge/Bridge.sol/Bridge.json +73 -42
- package/build/contracts/bridge/BridgeState.sol/BridgeState.dbg.json +1 -1
- package/build/contracts/bridge/BridgeState.sol/BridgeState.json +2 -2
- package/build/contracts/bridge/Deposit.sol/Deposit.dbg.json +1 -1
- package/build/contracts/bridge/Deposit.sol/Deposit.json +2 -2
- package/build/contracts/bridge/DepositSweep.sol/DepositSweep.dbg.json +1 -1
- package/build/contracts/bridge/DepositSweep.sol/DepositSweep.json +2 -2
- package/build/contracts/bridge/EcdsaLib.sol/EcdsaLib.dbg.json +1 -1
- package/build/contracts/bridge/Fraud.sol/Fraud.dbg.json +1 -1
- package/build/contracts/bridge/Fraud.sol/Fraud.json +2 -2
- package/build/contracts/bridge/Heartbeat.sol/Heartbeat.dbg.json +1 -1
- package/build/contracts/bridge/IRelay.sol/IRelay.dbg.json +1 -1
- package/build/contracts/bridge/MovingFunds.sol/MovingFunds.dbg.json +1 -1
- package/build/contracts/bridge/MovingFunds.sol/MovingFunds.json +2 -2
- package/build/contracts/bridge/Redemption.sol/OutboundTx.dbg.json +1 -1
- package/build/contracts/bridge/Redemption.sol/OutboundTx.json +2 -2
- package/build/contracts/bridge/Redemption.sol/Redemption.dbg.json +1 -1
- package/build/contracts/bridge/Redemption.sol/Redemption.json +2 -2
- 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 +2 -2
- package/build/contracts/token/TBTC.sol/TBTC.dbg.json +1 -1
- package/build/contracts/vault/DonationVault.sol/DonationVault.dbg.json +1 -1
- package/build/contracts/vault/DonationVault.sol/DonationVault.json +2 -2
- package/build/contracts/vault/IVault.sol/IVault.dbg.json +1 -1
- package/build/contracts/vault/TBTCVault.sol/TBTCVault.dbg.json +1 -1
- package/build/contracts/vault/TBTCVault.sol/TBTCVault.json +16 -16
- package/contracts/bank/Bank.sol +76 -39
- package/contracts/bridge/BitcoinTx.sol +1 -1
- package/contracts/bridge/Bridge.sol +85 -6
- package/contracts/bridge/Redemption.sol +160 -6
- package/contracts/vault/TBTCVault.sol +14 -14
- package/export.json +38 -16
- package/package.json +1 -1
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"type": "uint256"
|
|
74
74
|
}
|
|
75
75
|
],
|
|
76
|
-
"name": "
|
|
76
|
+
"name": "Unminted",
|
|
77
77
|
"type": "event"
|
|
78
78
|
},
|
|
79
79
|
{
|
|
@@ -235,19 +235,6 @@
|
|
|
235
235
|
"stateMutability": "nonpayable",
|
|
236
236
|
"type": "function"
|
|
237
237
|
},
|
|
238
|
-
{
|
|
239
|
-
"inputs": [
|
|
240
|
-
{
|
|
241
|
-
"internalType": "uint256",
|
|
242
|
-
"name": "amount",
|
|
243
|
-
"type": "uint256"
|
|
244
|
-
}
|
|
245
|
-
],
|
|
246
|
-
"name": "redeem",
|
|
247
|
-
"outputs": [],
|
|
248
|
-
"stateMutability": "nonpayable",
|
|
249
|
-
"type": "function"
|
|
250
|
-
},
|
|
251
238
|
{
|
|
252
239
|
"inputs": [],
|
|
253
240
|
"name": "tbtcToken",
|
|
@@ -273,10 +260,23 @@
|
|
|
273
260
|
"outputs": [],
|
|
274
261
|
"stateMutability": "nonpayable",
|
|
275
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"
|
|
276
276
|
}
|
|
277
277
|
],
|
|
278
|
-
"bytecode": "
|
|
279
|
-
"deployedBytecode": "
|
|
278
|
+
"bytecode": "0x608060405234801561001057600080fd5b5060405161114638038061114683398101604081905261002f916101a8565b6001600160a01b03821661008a5760405162461bcd60e51b815260206004820181905260248201527f42616e6b2063616e206e6f7420626520746865207a65726f206164647265737360448201526064015b60405180910390fd5b6001600160a01b0381166100ef5760405162461bcd60e51b815260206004820152602660248201527f5442544320746f6b656e2063616e206e6f7420626520746865207a65726f206160448201526564647265737360d01b6064820152608401610081565b603280546001600160a01b038085166001600160a01b03199283161790925560338054928416929091169190911790556101283361012f565b50506101e2565b600080546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527f5f56bee8cffbe9a78652a74a60705edede02af10b0bbb888ca44b79a0d42ce80910160405180910390a15050565b6001600160a01b03811681146101a557600080fd5b50565b600080604083850312156101bb57600080fd5b82516101c681610190565b60208401519092506101d781610190565b809150509250929050565b610f55806101f16000396000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c806376cdb03b11610081578063d38bfff41161005b578063d38bfff414610184578063e5d3d71414610197578063fc4e51f6146101aa57600080fd5b806376cdb03b1461014b5780638f4ffcb11461015e578063a0712d681461017157600080fd5b8063475d0570116100b2578063475d0570146100f65780635aa6e6751461010957806364e779b11461013857600080fd5b80631171bda9146100ce578063461c6373146100e3575b600080fd5b6100e16100dc366004610b4f565b6101bd565b005b6100e16100f1366004610bdc565b6102a9565b6100e1610104366004610c5e565b6103bc565b60005461011c906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b6100e1610146366004610d2b565b610535565b60325461011c906001600160a01b031681565b6100e161016c366004610d86565b610542565b6100e161017f366004610d2b565b610601565b6100e1610192366004610df9565b610755565b60335461011c906001600160a01b031681565b6100e16101b8366004610e1d565b610834565b6000546001600160a01b0316331461021c5760405162461bcd60e51b815260206004820152601c60248201527f43616c6c6572206973206e6f742074686520676f7665726e616e63650000000060448201526064015b60405180910390fd5b6033546040517f1171bda90000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015284811660248301526044820184905290911690631171bda9906064015b600060405180830381600087803b15801561028c57600080fd5b505af11580156102a0573d6000803e3d6000fd5b50505050505050565b6032546001600160a01b031633146103035760405162461bcd60e51b815260206004820152601660248201527f43616c6c6572206973206e6f74207468652042616e6b000000000000000000006044820152606401610213565b826103505760405162461bcd60e51b815260206004820152601760248201527f4e6f206465706f7369746f7273207370656369666965640000000000000000006044820152606401610213565b60005b838110156103b5576103a385858381811061037057610370610e73565b90506020020160208101906103859190610df9565b84848481811061039757610397610e73565b90506020020135610918565b806103ad81610e89565b915050610353565b5050505050565b6032546001600160a01b031633146104165760405162461bcd60e51b815260206004820152601660248201527f43616c6c6572206973206e6f74207468652042616e6b000000000000000000006044820152606401610213565b6032546040516370a0823160e01b81526001600160a01b038581166004830152849216906370a082319060240160206040518083038186803b15801561045b57600080fd5b505afa15801561046f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104939190610eb2565b10156104ec5760405162461bcd60e51b815260206004820152602260248201527f416d6f756e7420657863656564732062616c616e636520696e207468652062616044820152616e6b60f01b6064820152608401610213565b6104f68383610918565b603254604051631f1b6d2760e21b81526001600160a01b0385811660048301523060248301526044820185905290911690637c6db49c90606401610272565b61053f33826109ad565b50565b6033546001600160a01b0384811691161461059f5760405162461bcd60e51b815260206004820152601160248201527f546f6b656e206973206e6f7420544254430000000000000000000000000000006044820152606401610213565b336001600160a01b038416146105f75760405162461bcd60e51b815260206004820152601860248201527f4f6e6c7920544254432063616c6c657220616c6c6f77656400000000000000006044820152606401610213565b6103b585856109ad565b6032546040516370a0823160e01b815233600482018190529183916001600160a01b03909116906370a082319060240160206040518083038186803b15801561064957600080fd5b505afa15801561065d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106819190610eb2565b10156106da5760405162461bcd60e51b815260206004820152602260248201527f416d6f756e7420657863656564732062616c616e636520696e207468652062616044820152616e6b60f01b6064820152608401610213565b6106e48183610918565b603254604051631f1b6d2760e21b81526001600160a01b0383811660048301523060248301526044820185905290911690637c6db49c906064015b600060405180830381600087803b15801561073957600080fd5b505af115801561074d573d6000803e3d6000fd5b505050505050565b6000546001600160a01b031633146107af5760405162461bcd60e51b815260206004820152601c60248201527f43616c6c6572206973206e6f742074686520676f7665726e616e6365000000006044820152606401610213565b6001600160a01b03811661082b5760405162461bcd60e51b815260206004820152602260248201527f4e657720676f7665726e616e636520697320746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610213565b61053f81610ac1565b6000546001600160a01b0316331461088e5760405162461bcd60e51b815260206004820152601c60248201527f43616c6c6572206973206e6f742074686520676f7665726e616e6365000000006044820152606401610213565b6033546040517ffc4e51f60000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063fc4e51f6906108df9088908890889088908890600401610ecb565b600060405180830381600087803b1580156108f957600080fd5b505af115801561090d573d6000803e3d6000fd5b505050505050505050565b816001600160a01b03167f30385c845b448a36257a6a1716e6ad2e1bc2cbe333cde1e69fe849ad6511adfe8260405161095391815260200190565b60405180910390a26033546040517f40c10f190000000000000000000000000000000000000000000000000000000081526001600160a01b03848116600483015260248201849052909116906340c10f199060440161071f565b816001600160a01b03167f68751a4c3821398cb63d11609eca2440742ef19446f0c0261bfa8a13dd0748b8826040516109e891815260200190565b60405180910390a26033546040517f79cc67900000000000000000000000000000000000000000000000000000000081526001600160a01b03848116600483015260248201849052909116906379cc679090604401600060405180830381600087803b158015610a5757600080fd5b505af1158015610a6b573d6000803e3d6000fd5b50506032546040517f56a6d9ef0000000000000000000000000000000000000000000000000000000081526001600160a01b0386811660048301526024820186905290911692506356a6d9ef915060440161071f565b600080546001600160a01b038381167fffffffffffffffffffffffff000000000000000000000000000000000000000083168117909355604080519190921680825260208201939093527f5f56bee8cffbe9a78652a74a60705edede02af10b0bbb888ca44b79a0d42ce80910160405180910390a15050565b6001600160a01b038116811461053f57600080fd5b600080600060608486031215610b6457600080fd5b8335610b6f81610b3a565b92506020840135610b7f81610b3a565b929592945050506040919091013590565b60008083601f840112610ba257600080fd5b50813567ffffffffffffffff811115610bba57600080fd5b6020830191508360208260051b8501011115610bd557600080fd5b9250929050565b60008060008060408587031215610bf257600080fd5b843567ffffffffffffffff80821115610c0a57600080fd5b610c1688838901610b90565b90965094506020870135915080821115610c2f57600080fd5b50610c3c87828801610b90565b95989497509550505050565b634e487b7160e01b600052604160045260246000fd5b600080600060608486031215610c7357600080fd5b8335610c7e81610b3a565b925060208401359150604084013567ffffffffffffffff80821115610ca257600080fd5b818601915086601f830112610cb657600080fd5b813581811115610cc857610cc8610c48565b604051601f8201601f19908116603f01168101908382118183101715610cf057610cf0610c48565b81604052828152896020848701011115610d0957600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b600060208284031215610d3d57600080fd5b5035919050565b60008083601f840112610d5657600080fd5b50813567ffffffffffffffff811115610d6e57600080fd5b602083019150836020828501011115610bd557600080fd5b600080600080600060808688031215610d9e57600080fd5b8535610da981610b3a565b9450602086013593506040860135610dc081610b3a565b9250606086013567ffffffffffffffff811115610ddc57600080fd5b610de888828901610d44565b969995985093965092949392505050565b600060208284031215610e0b57600080fd5b8135610e1681610b3a565b9392505050565b600080600080600060808688031215610e3557600080fd5b8535610e4081610b3a565b94506020860135610e5081610b3a565b935060408601359250606086013567ffffffffffffffff811115610ddc57600080fd5b634e487b7160e01b600052603260045260246000fd5b6000600019821415610eab57634e487b7160e01b600052601160045260246000fd5b5060010190565b600060208284031215610ec457600080fd5b5051919050565b60006001600160a01b03808816835280871660208401525084604083015260806060830152826080830152828460a0840137600060a0848401015260a0601f19601f8501168301019050969550505050505056fea26469706673582212209e4975796006d1db5a7262daa7434fa2dbff97aad3fb5e7c0afab1d02413c3fa64736f6c63430008090033",
|
|
279
|
+
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100c95760003560e01c806376cdb03b11610081578063d38bfff41161005b578063d38bfff414610184578063e5d3d71414610197578063fc4e51f6146101aa57600080fd5b806376cdb03b1461014b5780638f4ffcb11461015e578063a0712d681461017157600080fd5b8063475d0570116100b2578063475d0570146100f65780635aa6e6751461010957806364e779b11461013857600080fd5b80631171bda9146100ce578063461c6373146100e3575b600080fd5b6100e16100dc366004610b4f565b6101bd565b005b6100e16100f1366004610bdc565b6102a9565b6100e1610104366004610c5e565b6103bc565b60005461011c906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b6100e1610146366004610d2b565b610535565b60325461011c906001600160a01b031681565b6100e161016c366004610d86565b610542565b6100e161017f366004610d2b565b610601565b6100e1610192366004610df9565b610755565b60335461011c906001600160a01b031681565b6100e16101b8366004610e1d565b610834565b6000546001600160a01b0316331461021c5760405162461bcd60e51b815260206004820152601c60248201527f43616c6c6572206973206e6f742074686520676f7665726e616e63650000000060448201526064015b60405180910390fd5b6033546040517f1171bda90000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015284811660248301526044820184905290911690631171bda9906064015b600060405180830381600087803b15801561028c57600080fd5b505af11580156102a0573d6000803e3d6000fd5b50505050505050565b6032546001600160a01b031633146103035760405162461bcd60e51b815260206004820152601660248201527f43616c6c6572206973206e6f74207468652042616e6b000000000000000000006044820152606401610213565b826103505760405162461bcd60e51b815260206004820152601760248201527f4e6f206465706f7369746f7273207370656369666965640000000000000000006044820152606401610213565b60005b838110156103b5576103a385858381811061037057610370610e73565b90506020020160208101906103859190610df9565b84848481811061039757610397610e73565b90506020020135610918565b806103ad81610e89565b915050610353565b5050505050565b6032546001600160a01b031633146104165760405162461bcd60e51b815260206004820152601660248201527f43616c6c6572206973206e6f74207468652042616e6b000000000000000000006044820152606401610213565b6032546040516370a0823160e01b81526001600160a01b038581166004830152849216906370a082319060240160206040518083038186803b15801561045b57600080fd5b505afa15801561046f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104939190610eb2565b10156104ec5760405162461bcd60e51b815260206004820152602260248201527f416d6f756e7420657863656564732062616c616e636520696e207468652062616044820152616e6b60f01b6064820152608401610213565b6104f68383610918565b603254604051631f1b6d2760e21b81526001600160a01b0385811660048301523060248301526044820185905290911690637c6db49c90606401610272565b61053f33826109ad565b50565b6033546001600160a01b0384811691161461059f5760405162461bcd60e51b815260206004820152601160248201527f546f6b656e206973206e6f7420544254430000000000000000000000000000006044820152606401610213565b336001600160a01b038416146105f75760405162461bcd60e51b815260206004820152601860248201527f4f6e6c7920544254432063616c6c657220616c6c6f77656400000000000000006044820152606401610213565b6103b585856109ad565b6032546040516370a0823160e01b815233600482018190529183916001600160a01b03909116906370a082319060240160206040518083038186803b15801561064957600080fd5b505afa15801561065d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106819190610eb2565b10156106da5760405162461bcd60e51b815260206004820152602260248201527f416d6f756e7420657863656564732062616c616e636520696e207468652062616044820152616e6b60f01b6064820152608401610213565b6106e48183610918565b603254604051631f1b6d2760e21b81526001600160a01b0383811660048301523060248301526044820185905290911690637c6db49c906064015b600060405180830381600087803b15801561073957600080fd5b505af115801561074d573d6000803e3d6000fd5b505050505050565b6000546001600160a01b031633146107af5760405162461bcd60e51b815260206004820152601c60248201527f43616c6c6572206973206e6f742074686520676f7665726e616e6365000000006044820152606401610213565b6001600160a01b03811661082b5760405162461bcd60e51b815260206004820152602260248201527f4e657720676f7665726e616e636520697320746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610213565b61053f81610ac1565b6000546001600160a01b0316331461088e5760405162461bcd60e51b815260206004820152601c60248201527f43616c6c6572206973206e6f742074686520676f7665726e616e6365000000006044820152606401610213565b6033546040517ffc4e51f60000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063fc4e51f6906108df9088908890889088908890600401610ecb565b600060405180830381600087803b1580156108f957600080fd5b505af115801561090d573d6000803e3d6000fd5b505050505050505050565b816001600160a01b03167f30385c845b448a36257a6a1716e6ad2e1bc2cbe333cde1e69fe849ad6511adfe8260405161095391815260200190565b60405180910390a26033546040517f40c10f190000000000000000000000000000000000000000000000000000000081526001600160a01b03848116600483015260248201849052909116906340c10f199060440161071f565b816001600160a01b03167f68751a4c3821398cb63d11609eca2440742ef19446f0c0261bfa8a13dd0748b8826040516109e891815260200190565b60405180910390a26033546040517f79cc67900000000000000000000000000000000000000000000000000000000081526001600160a01b03848116600483015260248201849052909116906379cc679090604401600060405180830381600087803b158015610a5757600080fd5b505af1158015610a6b573d6000803e3d6000fd5b50506032546040517f56a6d9ef0000000000000000000000000000000000000000000000000000000081526001600160a01b0386811660048301526024820186905290911692506356a6d9ef915060440161071f565b600080546001600160a01b038381167fffffffffffffffffffffffff000000000000000000000000000000000000000083168117909355604080519190921680825260208201939093527f5f56bee8cffbe9a78652a74a60705edede02af10b0bbb888ca44b79a0d42ce80910160405180910390a15050565b6001600160a01b038116811461053f57600080fd5b600080600060608486031215610b6457600080fd5b8335610b6f81610b3a565b92506020840135610b7f81610b3a565b929592945050506040919091013590565b60008083601f840112610ba257600080fd5b50813567ffffffffffffffff811115610bba57600080fd5b6020830191508360208260051b8501011115610bd557600080fd5b9250929050565b60008060008060408587031215610bf257600080fd5b843567ffffffffffffffff80821115610c0a57600080fd5b610c1688838901610b90565b90965094506020870135915080821115610c2f57600080fd5b50610c3c87828801610b90565b95989497509550505050565b634e487b7160e01b600052604160045260246000fd5b600080600060608486031215610c7357600080fd5b8335610c7e81610b3a565b925060208401359150604084013567ffffffffffffffff80821115610ca257600080fd5b818601915086601f830112610cb657600080fd5b813581811115610cc857610cc8610c48565b604051601f8201601f19908116603f01168101908382118183101715610cf057610cf0610c48565b81604052828152896020848701011115610d0957600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b600060208284031215610d3d57600080fd5b5035919050565b60008083601f840112610d5657600080fd5b50813567ffffffffffffffff811115610d6e57600080fd5b602083019150836020828501011115610bd557600080fd5b600080600080600060808688031215610d9e57600080fd5b8535610da981610b3a565b9450602086013593506040860135610dc081610b3a565b9250606086013567ffffffffffffffff811115610ddc57600080fd5b610de888828901610d44565b969995985093965092949392505050565b600060208284031215610e0b57600080fd5b8135610e1681610b3a565b9392505050565b600080600080600060808688031215610e3557600080fd5b8535610e4081610b3a565b94506020860135610e5081610b3a565b935060408601359250606086013567ffffffffffffffff811115610ddc57600080fd5b634e487b7160e01b600052603260045260246000fd5b6000600019821415610eab57634e487b7160e01b600052601160045260246000fd5b5060010190565b600060208284031215610ec457600080fd5b5051919050565b60006001600160a01b03808816835280871660208401525084604083015260806060830152826080830152828460a0840137600060a0848401015260a0601f19601f8501168301019050969550505050505056fea26469706673582212209e4975796006d1db5a7262daa7434fa2dbff97aad3fb5e7c0afab1d02413c3fa64736f6c63430008090033",
|
|
280
280
|
"linkReferences": {},
|
|
281
281
|
"deployedLinkReferences": {}
|
|
282
282
|
}
|
package/contracts/bank/Bank.sol
CHANGED
|
@@ -22,16 +22,16 @@ import "../vault/IVault.sol";
|
|
|
22
22
|
|
|
23
23
|
/// @title Bitcoin Bank
|
|
24
24
|
/// @notice Bank is a central component tracking Bitcoin balances. Balances can
|
|
25
|
-
/// be transferred between
|
|
26
|
-
/// balances to be spent by others. Balances in the Bank
|
|
27
|
-
/// depositors who
|
|
28
|
-
/// 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.
|
|
29
29
|
/// @dev Bank is a governable contract and the Governance can upgrade the Bridge
|
|
30
30
|
/// address.
|
|
31
31
|
contract Bank is Ownable {
|
|
32
32
|
address public bridge;
|
|
33
33
|
|
|
34
|
-
/// @notice The balance of
|
|
34
|
+
/// @notice The balance of the given account in the Bank. Zero by default.
|
|
35
35
|
mapping(address => uint256) public balanceOf;
|
|
36
36
|
|
|
37
37
|
/// @notice The remaining amount of balance a spender will be
|
|
@@ -39,16 +39,17 @@ contract Bank is Ownable {
|
|
|
39
39
|
/// `transferBalanceFrom`. Zero by default.
|
|
40
40
|
mapping(address => mapping(address => uint256)) public allowance;
|
|
41
41
|
|
|
42
|
-
/// @notice Returns the current nonce for EIP2612 permission for the
|
|
43
|
-
/// provided balance owner
|
|
44
|
-
/// construct EIP2612 signature provided to `permit`
|
|
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.
|
|
45
46
|
mapping(address => uint256) public nonce;
|
|
46
47
|
|
|
47
48
|
uint256 public immutable cachedChainId;
|
|
48
49
|
bytes32 public immutable cachedDomainSeparator;
|
|
49
50
|
|
|
50
|
-
/// @notice Returns EIP2612 Permit message hash. Used to construct
|
|
51
|
-
/// 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.
|
|
52
53
|
bytes32 public constant PERMIT_TYPEHASH =
|
|
53
54
|
keccak256(
|
|
54
55
|
"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"
|
|
@@ -87,6 +88,9 @@ contract Bank is Ownable {
|
|
|
87
88
|
/// check the status of the Bridge. The Governance implementation needs
|
|
88
89
|
/// to ensure all requirements for the upgrade are satisfied before
|
|
89
90
|
/// executing this function.
|
|
91
|
+
/// Requirements:
|
|
92
|
+
/// - The new Bridge address must not be zero.
|
|
93
|
+
/// @param _bridge The new Bridge address.
|
|
90
94
|
function updateBridge(address _bridge) external onlyOwner {
|
|
91
95
|
require(_bridge != address(0), "Bridge address must not be 0x0");
|
|
92
96
|
bridge = _bridge;
|
|
@@ -98,19 +102,23 @@ contract Bank is Ownable {
|
|
|
98
102
|
/// @dev Requirements:
|
|
99
103
|
/// - `recipient` cannot be the zero address,
|
|
100
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.
|
|
101
107
|
function transferBalance(address recipient, uint256 amount) external {
|
|
102
108
|
_transferBalance(msg.sender, recipient, amount);
|
|
103
109
|
}
|
|
104
110
|
|
|
105
111
|
/// @notice Sets `amount` as the allowance of `spender` over the caller's
|
|
106
112
|
/// balance.
|
|
107
|
-
/// @dev If the `amount` is set to `type(uint256).max
|
|
113
|
+
/// @dev If the `amount` is set to `type(uint256).max`,
|
|
108
114
|
/// `transferBalanceFrom` will not reduce an allowance.
|
|
109
115
|
/// Beware that changing an allowance with this function brings the
|
|
110
116
|
/// risk that someone may use both the old and the new allowance by
|
|
111
117
|
/// unfortunate transaction ordering. Please use
|
|
112
118
|
/// `increaseBalanceAllowance` and `decreaseBalanceAllowance` to
|
|
113
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.
|
|
114
122
|
function approveBalance(address spender, uint256 amount) external {
|
|
115
123
|
_approveBalance(msg.sender, spender, amount);
|
|
116
124
|
}
|
|
@@ -125,6 +133,11 @@ contract Bank is Ownable {
|
|
|
125
133
|
/// both the old and the new allowance by unfortunate transaction
|
|
126
134
|
/// ordering. Please use `increaseBalanceAllowance` and
|
|
127
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.
|
|
128
141
|
function approveBalanceAndCall(
|
|
129
142
|
address spender,
|
|
130
143
|
uint256 amount,
|
|
@@ -138,8 +151,10 @@ contract Bank is Ownable {
|
|
|
138
151
|
);
|
|
139
152
|
}
|
|
140
153
|
|
|
141
|
-
/// @notice Atomically increases the balance allowance granted to
|
|
142
|
-
///
|
|
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.
|
|
143
158
|
function increaseBalanceAllowance(address spender, uint256 addedValue)
|
|
144
159
|
external
|
|
145
160
|
{
|
|
@@ -150,8 +165,14 @@ contract Bank is Ownable {
|
|
|
150
165
|
);
|
|
151
166
|
}
|
|
152
167
|
|
|
153
|
-
/// @notice Atomically decreases the balance allowance granted to
|
|
154
|
-
///
|
|
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.
|
|
155
176
|
function decreaseBalanceAllowance(address spender, uint256 subtractedValue)
|
|
156
177
|
external
|
|
157
178
|
{
|
|
@@ -175,8 +196,11 @@ contract Bank is Ownable {
|
|
|
175
196
|
/// @dev Requirements:
|
|
176
197
|
/// - `recipient` cannot be the zero address,
|
|
177
198
|
/// - `spender` must have a balance of at least `amount`,
|
|
178
|
-
/// - the caller must have allowance for `spender`'s balance of at
|
|
199
|
+
/// - the caller must have an allowance for `spender`'s balance of at
|
|
179
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.
|
|
180
204
|
function transferBalanceFrom(
|
|
181
205
|
address spender,
|
|
182
206
|
address recipient,
|
|
@@ -195,12 +219,13 @@ contract Bank is Ownable {
|
|
|
195
219
|
_transferBalance(spender, recipient, amount);
|
|
196
220
|
}
|
|
197
221
|
|
|
198
|
-
/// @notice EIP2612 approval made with secp256k1 signature.
|
|
199
|
-
///
|
|
200
|
-
/// conforming EIP712 standard, rather than an on-chain
|
|
201
|
-
/// from their address. Anyone can submit this signature
|
|
202
|
-
/// user's behalf by calling the permit function, paying
|
|
203
|
-
/// and possibly performing other actions in the same
|
|
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.
|
|
204
229
|
/// @dev The deadline argument can be set to `type(uint256).max to create
|
|
205
230
|
/// permits that effectively never expire. If the `amount` is set
|
|
206
231
|
/// to `type(uint256).max` then `transferBalanceFrom` will not
|
|
@@ -209,6 +234,13 @@ contract Bank is Ownable {
|
|
|
209
234
|
/// new allowance by unfortunate transaction ordering. Please use
|
|
210
235
|
/// `increaseBalanceAllowance` and `decreaseBalanceAllowance` to
|
|
211
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.
|
|
212
244
|
function permit(
|
|
213
245
|
address owner,
|
|
214
246
|
address spender,
|
|
@@ -258,7 +290,10 @@ contract Bank is Ownable {
|
|
|
258
290
|
/// @notice Increases balances of the provided `recipients` by the provided
|
|
259
291
|
/// `amounts`. Can only be called by the Bridge.
|
|
260
292
|
/// @dev Requirements:
|
|
261
|
-
/// - 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.
|
|
262
297
|
function increaseBalances(
|
|
263
298
|
address[] calldata recipients,
|
|
264
299
|
uint256[] calldata amounts
|
|
@@ -274,6 +309,10 @@ contract Bank is Ownable {
|
|
|
274
309
|
|
|
275
310
|
/// @notice Increases balance of the provided `recipient` by the provided
|
|
276
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.
|
|
277
316
|
function increaseBalance(address recipient, uint256 amount)
|
|
278
317
|
external
|
|
279
318
|
onlyBridge
|
|
@@ -282,39 +321,37 @@ contract Bank is Ownable {
|
|
|
282
321
|
}
|
|
283
322
|
|
|
284
323
|
/// @notice Increases the given smart contract `vault`'s balance and
|
|
285
|
-
/// notifies the `vault` contract
|
|
286
|
-
/// the deposits routed by depositors to that `vault` have been
|
|
287
|
-
/// swept by the Bridge. This way, the depositor does not have to
|
|
288
|
-
/// issue a separate transaction to the `vault` contract.
|
|
324
|
+
/// notifies the `vault` contract about it.
|
|
289
325
|
/// Can be called only by the Bridge.
|
|
290
326
|
/// @dev Requirements:
|
|
291
327
|
/// - `vault` must implement `IVault` interface,
|
|
292
|
-
/// - length of `
|
|
328
|
+
/// - length of `recipients` and `amounts` must be the same.
|
|
293
329
|
/// @param vault Address of `IVault` recipient contract.
|
|
294
|
-
/// @param
|
|
295
|
-
/// @param
|
|
296
|
-
/// swept. The `vault`'s balance in the Bank will be increased by the
|
|
297
|
-
/// sum of all elements in this array.
|
|
330
|
+
/// @param recipients Balance increase recipients.
|
|
331
|
+
/// @param amounts Amounts by which balances are increased.
|
|
298
332
|
function increaseBalanceAndCall(
|
|
299
333
|
address vault,
|
|
300
|
-
address[] calldata
|
|
301
|
-
uint256[] calldata
|
|
334
|
+
address[] calldata recipients,
|
|
335
|
+
uint256[] calldata amounts
|
|
302
336
|
) external onlyBridge {
|
|
303
337
|
require(
|
|
304
|
-
|
|
338
|
+
recipients.length == amounts.length,
|
|
305
339
|
"Arrays must have the same length"
|
|
306
340
|
);
|
|
307
341
|
uint256 totalAmount = 0;
|
|
308
|
-
for (uint256 i = 0; i <
|
|
309
|
-
totalAmount +=
|
|
342
|
+
for (uint256 i = 0; i < amounts.length; i++) {
|
|
343
|
+
totalAmount += amounts[i];
|
|
310
344
|
}
|
|
311
345
|
_increaseBalance(vault, totalAmount);
|
|
312
|
-
IVault(vault).receiveBalanceIncrease(
|
|
346
|
+
IVault(vault).receiveBalanceIncrease(recipients, amounts);
|
|
313
347
|
}
|
|
314
348
|
|
|
315
349
|
/// @notice Decreases caller's balance by the provided `amount`. There is no
|
|
316
350
|
/// way to restore the balance so do not call this function unless
|
|
317
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.
|
|
318
355
|
function decreaseBalance(uint256 amount) external {
|
|
319
356
|
balanceOf[msg.sender] -= amount;
|
|
320
357
|
emit BalanceDecreased(msg.sender, amount);
|
|
@@ -322,7 +359,7 @@ contract Bank is Ownable {
|
|
|
322
359
|
|
|
323
360
|
/// @notice Returns hash of EIP712 Domain struct with `TBTC Bank` as
|
|
324
361
|
/// a signing domain and Bank contract as a verifying contract.
|
|
325
|
-
/// Used to construct EIP2612 signature provided to `permit`
|
|
362
|
+
/// Used to construct an EIP2612 signature provided to the `permit`
|
|
326
363
|
/// function.
|
|
327
364
|
/* solhint-disable-next-line func-name-mixedcase */
|
|
328
365
|
function DOMAIN_SEPARATOR() public view returns (bytes32) {
|
|
@@ -266,7 +266,7 @@ library BitcoinTx {
|
|
|
266
266
|
/// on a 20-byte public key hash.
|
|
267
267
|
function extractPubKeyHash(BridgeState.Storage storage, bytes memory output)
|
|
268
268
|
internal
|
|
269
|
-
|
|
269
|
+
pure
|
|
270
270
|
returns (bytes20 pubKeyHash)
|
|
271
271
|
{
|
|
272
272
|
bytes memory pubKeyHashBytes = output.extractHash();
|
|
@@ -19,6 +19,7 @@ import "@keep-network/random-beacon/contracts/Governable.sol";
|
|
|
19
19
|
import {IWalletOwner as EcdsaWalletOwner} from "@keep-network/ecdsa/contracts/api/IWalletOwner.sol";
|
|
20
20
|
|
|
21
21
|
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
|
22
|
+
import "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol";
|
|
22
23
|
|
|
23
24
|
import "./IRelay.sol";
|
|
24
25
|
import "./BridgeState.sol";
|
|
@@ -31,6 +32,7 @@ import "./Wallets.sol";
|
|
|
31
32
|
import "./Fraud.sol";
|
|
32
33
|
import "./MovingFunds.sol";
|
|
33
34
|
|
|
35
|
+
import "../bank/IReceiveBalanceApproval.sol";
|
|
34
36
|
import "../bank/Bank.sol";
|
|
35
37
|
|
|
36
38
|
/// @title Bitcoin Bridge
|
|
@@ -54,7 +56,12 @@ import "../bank/Bank.sol";
|
|
|
54
56
|
/// @dev Bridge is an upgradeable component of the Bank. The order of
|
|
55
57
|
/// functionalities in this contract is: deposit, sweep, redemption,
|
|
56
58
|
/// moving funds, wallet lifecycle, frauds, parameters.
|
|
57
|
-
contract Bridge is
|
|
59
|
+
contract Bridge is
|
|
60
|
+
Governable,
|
|
61
|
+
EcdsaWalletOwner,
|
|
62
|
+
Initializable,
|
|
63
|
+
IReceiveBalanceApproval
|
|
64
|
+
{
|
|
58
65
|
using BridgeState for BridgeState.Storage;
|
|
59
66
|
using Deposit for BridgeState.Storage;
|
|
60
67
|
using DepositSweep for BridgeState.Storage;
|
|
@@ -386,7 +393,9 @@ contract Bridge is Governable, EcdsaWalletOwner, Initializable {
|
|
|
386
393
|
}
|
|
387
394
|
|
|
388
395
|
/// @notice Requests redemption of the given amount from the specified
|
|
389
|
-
/// wallet to the redeemer Bitcoin output script.
|
|
396
|
+
/// wallet to the redeemer Bitcoin output script. Handles the
|
|
397
|
+
/// simplest case in which the redeemer's balance is decreased in
|
|
398
|
+
/// the Bank.
|
|
390
399
|
/// @param walletPubKeyHash The 20-byte wallet public key hash (computed
|
|
391
400
|
/// using Bitcoin HASH160 over the compressed ECDSA public key).
|
|
392
401
|
/// @param mainUtxo Data of the wallet's main UTXO, as currently known on
|
|
@@ -394,8 +403,8 @@ contract Bridge is Governable, EcdsaWalletOwner, Initializable {
|
|
|
394
403
|
/// @param redeemerOutputScript The redeemer's length-prefixed output
|
|
395
404
|
/// script (P2PKH, P2WPKH, P2SH or P2WSH) that will be used to lock
|
|
396
405
|
/// redeemed BTC.
|
|
397
|
-
/// @param amount Requested amount in satoshi. This is also the
|
|
398
|
-
/// that is taken from
|
|
406
|
+
/// @param amount Requested amount in satoshi. This is also the Bank balance
|
|
407
|
+
/// that is taken from the `balanceOwner` upon request.
|
|
399
408
|
/// Once the request is handled, the actual amount of BTC locked
|
|
400
409
|
/// on the redeemer output script will be always lower than this value
|
|
401
410
|
/// since the treasury and Bitcoin transaction fees must be incurred.
|
|
@@ -423,11 +432,81 @@ contract Bridge is Governable, EcdsaWalletOwner, Initializable {
|
|
|
423
432
|
self.requestRedemption(
|
|
424
433
|
walletPubKeyHash,
|
|
425
434
|
mainUtxo,
|
|
435
|
+
msg.sender,
|
|
426
436
|
redeemerOutputScript,
|
|
427
437
|
amount
|
|
428
438
|
);
|
|
429
439
|
}
|
|
430
440
|
|
|
441
|
+
/// @notice Requests redemption of the given amount from the specified
|
|
442
|
+
/// wallet to the redeemer Bitcoin output script. Used by
|
|
443
|
+
/// `Bank.approveBalanceAndCall`. Can handle more complex cases
|
|
444
|
+
/// where balance owner may be someone else than the redeemer.
|
|
445
|
+
/// For example, vault redeeming its balance for some depositor.
|
|
446
|
+
/// @param balanceOwner The address of the Bank balance owner whose balance
|
|
447
|
+
/// is getting redeemed.
|
|
448
|
+
/// @param amount Requested amount in satoshi. This is also the Bank balance
|
|
449
|
+
/// that is taken from the `balanceOwner` upon request.
|
|
450
|
+
/// Once the request is handled, the actual amount of BTC locked
|
|
451
|
+
/// on the redeemer output script will be always lower than this value
|
|
452
|
+
/// since the treasury and Bitcoin transaction fees must be incurred.
|
|
453
|
+
/// The minimal amount satisfying the request can be computed as:
|
|
454
|
+
/// `amount - (amount / redemptionTreasuryFeeDivisor) - redemptionTxMaxFee`.
|
|
455
|
+
/// Fees values are taken at the moment of request creation.
|
|
456
|
+
/// @param redemptionData ABI-encoded redemption data:
|
|
457
|
+
/// [
|
|
458
|
+
/// address redeemer,
|
|
459
|
+
/// bytes20 walletPubKeyHash,
|
|
460
|
+
/// bytes32 mainUtxoTxHash,
|
|
461
|
+
/// uint32 mainUtxoTxOutputIndex,
|
|
462
|
+
/// uint64 mainUtxoTxOutputValue,
|
|
463
|
+
/// bytes redeemerOutputScript
|
|
464
|
+
/// ]
|
|
465
|
+
///
|
|
466
|
+
/// - redeemer: The Ethereum address of the redeemer who will be able
|
|
467
|
+
/// to claim Bank balance if anything goes wrong during the redemption.
|
|
468
|
+
/// In the most basic case, when someone redeems their balance
|
|
469
|
+
/// from the Bank, `balanceOwner` is the same as `redemeer`.
|
|
470
|
+
/// However, when a Vault is redeeming part of its balance for some
|
|
471
|
+
/// redeemer address (for example, someone who has earlier deposited
|
|
472
|
+
/// into that Vault), `balanceOwner` is the Vault, and `redemeer` is
|
|
473
|
+
/// the address for which the vault is redeeming its balance to,
|
|
474
|
+
/// - walletPubKeyHash: The 20-byte wallet public key hash (computed
|
|
475
|
+
/// using Bitcoin HASH160 over the compressed ECDSA public key),
|
|
476
|
+
/// - mainUtxoTxHash: Data of the wallet's main UTXO TX hash, as
|
|
477
|
+
/// currently known on the Ethereum chain,
|
|
478
|
+
/// - mainUtxoTxOutputIndex: Data of the wallet's main UTXO output
|
|
479
|
+
/// index, as currently known on Ethereum chain,
|
|
480
|
+
/// - mainUtxoTxOutputValue: Data of the wallet's main UTXO output
|
|
481
|
+
/// value, as currently known on Ethereum chain,
|
|
482
|
+
/// - redeemerOutputScript The redeemer's length-prefixed output
|
|
483
|
+
/// script (P2PKH, P2WPKH, P2SH or P2WSH) that will be used to lock
|
|
484
|
+
/// redeemed BTC.
|
|
485
|
+
/// @dev Requirements:
|
|
486
|
+
/// - The caller must be the Bank,
|
|
487
|
+
/// - Wallet behind `walletPubKeyHash` must be live,
|
|
488
|
+
/// - `mainUtxo` components must point to the recent main UTXO
|
|
489
|
+
/// of the given wallet, as currently known on the Ethereum chain,
|
|
490
|
+
/// - `redeemerOutputScript` must be a proper Bitcoin script,
|
|
491
|
+
/// - `redeemerOutputScript` cannot have wallet PKH as payload,
|
|
492
|
+
/// - `amount` must be above or equal the `redemptionDustThreshold`,
|
|
493
|
+
/// - Given `walletPubKeyHash` and `redeemerOutputScript` pair can be
|
|
494
|
+
/// used for only one pending request at the same time,
|
|
495
|
+
/// - Wallet must have enough Bitcoin balance to proceed the request,
|
|
496
|
+
function receiveBalanceApproval(
|
|
497
|
+
address balanceOwner,
|
|
498
|
+
uint256 amount,
|
|
499
|
+
bytes calldata redemptionData
|
|
500
|
+
) external override {
|
|
501
|
+
require(msg.sender == address(self.bank), "Caller is not the bank");
|
|
502
|
+
|
|
503
|
+
self.requestRedemption(
|
|
504
|
+
balanceOwner,
|
|
505
|
+
SafeCastUpgradeable.toUint64(amount),
|
|
506
|
+
redemptionData
|
|
507
|
+
);
|
|
508
|
+
}
|
|
509
|
+
|
|
431
510
|
/// @notice Used by the wallet to prove the BTC redemption transaction
|
|
432
511
|
/// and to make the necessary bookkeeping. Redemption is only
|
|
433
512
|
/// accepted if it satisfies SPV proof.
|
|
@@ -1115,7 +1194,7 @@ contract Bridge is Governable, EcdsaWalletOwner, Initializable {
|
|
|
1115
1194
|
/// It is the time after which the redemption request can be reported
|
|
1116
1195
|
/// as timed out. It is counted from the moment when the redemption
|
|
1117
1196
|
/// request was created via `requestRedemption` call. Reported timed
|
|
1118
|
-
/// out requests are cancelled and locked
|
|
1197
|
+
/// out requests are cancelled and locked balance is returned to the
|
|
1119
1198
|
/// redeemer in full amount.
|
|
1120
1199
|
/// @param redemptionTimeoutSlashingAmount New value of the redemption
|
|
1121
1200
|
/// timeout slashing amount in T, it is the amount slashed from each
|
|
@@ -1502,7 +1581,7 @@ contract Bridge is Governable, EcdsaWalletOwner, Initializable {
|
|
|
1502
1581
|
/// @return redemptionTimeout Time after which the redemption request can be
|
|
1503
1582
|
/// reported as timed out. It is counted from the moment when the
|
|
1504
1583
|
/// redemption request was created via `requestRedemption` call.
|
|
1505
|
-
/// Reported timed out requests are cancelled and locked
|
|
1584
|
+
/// Reported timed out requests are cancelled and locked balance is
|
|
1506
1585
|
/// returned to the redeemer in full amount.
|
|
1507
1586
|
/// @return redemptionTimeoutSlashingAmount The amount of stake slashed
|
|
1508
1587
|
/// from each member of a wallet for a redemption timeout.
|