@keep-network/tbtc-v2 0.1.1-dev.52 → 0.1.1-dev.53
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 +3 -3
- package/artifacts/Bridge.json +176 -118
- package/artifacts/Deposit.json +7 -7
- package/artifacts/EcdsaDkgValidator.json +1 -1
- package/artifacts/EcdsaInactivity.json +1 -1
- package/artifacts/Fraud.json +9 -9
- 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 +14 -13
- package/artifacts/ReimbursementPool.json +2 -2
- package/artifacts/Relay.json +9 -9
- package/artifacts/SortitionPool.json +2 -2
- package/artifacts/Sweep.json +7 -7
- package/artifacts/T.json +2 -2
- package/artifacts/TBTC.json +3 -3
- package/artifacts/TBTCToken.json +3 -3
- package/artifacts/TokenStaking.json +1 -1
- package/artifacts/TokenholderGovernor.json +9 -9
- package/artifacts/TokenholderTimelock.json +8 -8
- package/artifacts/VendingMachine.json +10 -10
- package/artifacts/VendingMachineKeep.json +1 -1
- package/artifacts/VendingMachineNuCypher.json +1 -1
- package/artifacts/WalletRegistry.json +2 -2
- package/artifacts/WalletRegistryGovernance.json +2 -2
- package/artifacts/Wallets.json +9 -9
- package/artifacts/solcInputs/{dcf2fc19e497270603c798faeb0a9ba9.json → fa22a04615b4037761340d27e55c86ee.json} +4 -4
- package/build/contracts/GovernanceUtils.sol/GovernanceUtils.dbg.json +1 -1
- package/build/contracts/bank/Bank.sol/Bank.dbg.json +1 -1
- package/build/contracts/bridge/BitcoinTx.sol/BitcoinTx.dbg.json +1 -1
- package/build/contracts/bridge/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 +71 -34
- package/build/contracts/bridge/BridgeState.sol/BridgeState.dbg.json +1 -1
- package/build/contracts/bridge/BridgeState.sol/BridgeState.json +14 -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/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/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/Sweep.sol/Sweep.dbg.json +1 -1
- package/build/contracts/bridge/Sweep.sol/Sweep.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/IVault.sol/IVault.dbg.json +1 -1
- package/build/contracts/vault/TBTCVault.sol/TBTCVault.dbg.json +1 -1
- package/contracts/bridge/Bridge.sol +60 -16
- package/contracts/bridge/BridgeState.sol +34 -3
- package/contracts/bridge/Redemption.sol +33 -11
- package/contracts/bridge/Wallets.sol +5 -9
- package/export.json +37 -0
- package/package.json +1 -1
|
@@ -105,8 +105,8 @@
|
|
|
105
105
|
"type": "event"
|
|
106
106
|
}
|
|
107
107
|
],
|
|
108
|
-
"bytecode": "
|
|
109
|
-
"deployedBytecode": "
|
|
108
|
+
"bytecode": "0x610fc961003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100565760003560e01c80634afbe4c91461005b57806399b0b8471461007d578063c87de7f41461009d578063d079fbb1146100bd575b600080fd5b81801561006757600080fd5b5061007b610076366004610d6d565b6100dd565b005b81801561008957600080fd5b5061007b610098366004610db7565b610303565b8180156100a957600080fd5b5061007b6100b8366004610e08565b61053c565b8180156100c957600080fd5b5061007b6100d8366004610e34565b610662565b60028401546001600160a01b0316331461014e5760405162461bcd60e51b815260206004820152602760248201527f43616c6c6572206973206e6f74207468652045434453412057616c6c657420526044820152666567697374727960c81b60648201526084015b60405180910390fd5b600061016261015d8484610961565b610a0b565b6bffffffffffffffffffffffff198116600090815260188701602052604081209192506002820154600160a01b900460ff1660058111156101a5576101a5610e61565b146102185760405162461bcd60e51b815260206004820152602860248201527f45434453412077616c6c657420686173206265656e20616c726561647920726560448201527f67697374657265640000000000000000000000000000000000000000000000006064820152608401610145565b848155600281018054600160a01b63ffffffff42811668010000000000000000027fffffffffffffffffffffff00ffffffffffffffff00000000ffffffffffffffff909316929092178117909255601688018054606086901c73ffffffffffffffffffffffffffffffffffffffff1990911617808255929092041690601461029f83610e8d565b91906101000a81548163ffffffff021916908363ffffffff16021790555050816bffffffffffffffffffffffff1916857f2dbb47dce81d6b11cca1f1e3b10143d6f7e1e7e92d2dd9aacbb1f875379d308e60405160405180910390a3505050505050565b601683015460601b6bffffffffffffffffffffffff1990811690831614156103935760405162461bcd60e51b815260206004820152602c60248201527f4163746976652077616c6c65742063616e6e6f7420626520636f6e736964657260448201527f656420636c6f736561626c6500000000000000000000000000000000000000006064820152608401610145565b6bffffffffffffffffffffffff1982166000908152601884016020526040902060016002820154600160a01b900460ff1660058111156103d5576103d5610e61565b1461042d5760405162461bcd60e51b815260206004820152602260248201527f45434453412077616c6c6574206d75737420626520696e204c69766520737461604482015261746560f01b6064820152608401610145565b6015840154600282015460009161047a9163ffffffff7c01000000000000000000000000000000000000000000000000000000009092048216916801000000000000000090910416610eb1565b63ffffffff16421015905080806104b957506015850154600160a01b900467ffffffffffffffff166104ad868686610a32565b67ffffffffffffffff16105b61052b5760405162461bcd60e51b815260206004820152603660248201527f57616c6c6574206e6565647320746f206265206f6c6420656e6f756768206f7260448201527f206861766520746f6f20666577207361746f73686973000000000000000000006064820152608401610145565b6105358585610b6a565b5050505050565b60028301546001600160a01b031633146105a85760405162461bcd60e51b815260206004820152602760248201527f43616c6c6572206973206e6f74207468652045434453412057616c6c657420526044820152666567697374727960c81b6064820152608401610145565b60006105b761015d8484610961565b905060016bffffffffffffffffffffffff1982166000908152601886016020526040902060020154600160a01b900460ff1660058111156105fa576105fa610e61565b146106525760405162461bcd60e51b815260206004820152602260248201527f45434453412077616c6c6574206d75737420626520696e204c69766520737461604482015261746560f01b6064820152608401610145565b61065c8482610b6a565b50505050565b6002820154604080517fcc56238800000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163cc562388916004808301926020929190829003018186803b1580156106c257600080fd5b505afa1580156106d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106fa9190610ed9565b600381111561070b5761070b610e61565b1461077e5760405162461bcd60e51b815260206004820152602360248201527f57616c6c6574206372656174696f6e20616c726561647920696e2070726f677260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610145565b601682015460601b6bffffffffffffffffffffffff198116156108c95760006107a8848385610a32565b6bffffffffffffffffffffffff1983166000908152601886016020526040812060020154601587015492935063ffffffff680100000000000000009091048116926107f4911683610eb1565b63ffffffff1642101590508080156108265750601586015467ffffffffffffffff640100000000909104811690841610155b806108535750601586015467ffffffffffffffff6c01000000000000000000000000909104811690841610155b6108c55760405162461bcd60e51b815260206004820152602660248201527f57616c6c6574206372656174696f6e20636f6e646974696f6e7320617265206e60448201527f6f74206d657400000000000000000000000000000000000000000000000000006064820152608401610145565b5050505b6040517f31fecb80caf1e1128496dd5a6f1083ba29fd5fe64c3fe04e2d1b6f9cfc27d5a390600090a18260020160009054906101000a90046001600160a01b03166001600160a01b03166372cc8c6d6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561094457600080fd5b505af1158015610958573d6000803e3d6000fd5b50505050505050565b60606000610970600284610f01565b61099b57507f02000000000000000000000000000000000000000000000000000000000000006109be565b507f03000000000000000000000000000000000000000000000000000000000000005b6040517fff00000000000000000000000000000000000000000000000000000000000000821660208201526021810185905260410160405160208183030381529060405291505092915050565b60006020600083516020850160025afa50602060006020600060035afa5050600c51919050565b6bffffffffffffffffffffffff19821660009081526018840160205260408120600101548015610b6257808335610a6f6040860160208701610f23565b610a7f6060870160408801610f49565b604051602001610aec9392919092835260e09190911b7fffffffff0000000000000000000000000000000000000000000000000000000016602083015260c01b7fffffffffffffffff000000000000000000000000000000000000000000000000166024820152602c0190565b6040516020818303038152906040528051906020012014610b4f5760405162461bcd60e51b815260206004820152601d60248201527f496e76616c69642077616c6c6574206d61696e205554584f20646174610000006044820152606401610145565b610b5f6060840160408501610f49565b91505b509392505050565b6bffffffffffffffffffffffff198116600090815260188301602052604090206001810154610ba257610b9d8383610cbf565b610c3a565b60028101805463ffffffff42166c01000000000000000000000000027fffffffffffffffffffffff00ffffffff00000000ffffffffffffffffffffffff909116177402000000000000000000000000000000000000000017905580546040516bffffffffffffffffffffffff19841691907fbdc9ce990a067e5fd3a5d8dfc68e27e9f221aaa3fe55265e0b7e93c460b3efe290600090a35b601683015460601b6bffffffffffffffffffffffff199081169083161415610c7c5760168301805473ffffffffffffffffffffffffffffffffffffffff191690555b601683018054600160a01b900463ffffffff16906014610c9b83610f73565b91906101000a81548163ffffffff021916908363ffffffff16021790555050505050565b6bffffffffffffffffffffffff198116600081815260188401602052604080822060028101805463ffffffff4216700100000000000000000000000000000000027fffffffffffffffffffffff0000000000ffffffffffffffffffffffffffffffff9091161774030000000000000000000000000000000000000000179055805491519093927f68cb496f5e64383745876664ef119840f154a729c03ba866b8aecb5c9f53d51691a3505050565b60008060008060808587031215610d8357600080fd5b5050823594602084013594506040840135936060013592509050565b600060608284031215610db157600080fd5b50919050565b600080600060a08486031215610dcc57600080fd5b8335925060208401356bffffffffffffffffffffffff1981168114610df057600080fd5b9150610dff8560408601610d9f565b90509250925092565b600080600060608486031215610e1d57600080fd5b505081359360208301359350604090920135919050565b60008060808385031215610e4757600080fd5b82359150610e588460208501610d9f565b90509250929050565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600063ffffffff80831681811415610ea757610ea7610e77565b6001019392505050565b600063ffffffff808316818516808303821115610ed057610ed0610e77565b01949350505050565b600060208284031215610eeb57600080fd5b815160048110610efa57600080fd5b9392505050565b600082610f1e57634e487b7160e01b600052601260045260246000fd5b500690565b600060208284031215610f3557600080fd5b813563ffffffff81168114610efa57600080fd5b600060208284031215610f5b57600080fd5b813567ffffffffffffffff81168114610efa57600080fd5b600063ffffffff821680610f8957610f89610e77565b600019019291505056fea264697066735822122096029d789a86d700205ad41f66aeb39f80cd5e687414fe625f63d07730ed954064736f6c63430008090033",
|
|
109
|
+
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100565760003560e01c80634afbe4c91461005b57806399b0b8471461007d578063c87de7f41461009d578063d079fbb1146100bd575b600080fd5b81801561006757600080fd5b5061007b610076366004610d6d565b6100dd565b005b81801561008957600080fd5b5061007b610098366004610db7565b610303565b8180156100a957600080fd5b5061007b6100b8366004610e08565b61053c565b8180156100c957600080fd5b5061007b6100d8366004610e34565b610662565b60028401546001600160a01b0316331461014e5760405162461bcd60e51b815260206004820152602760248201527f43616c6c6572206973206e6f74207468652045434453412057616c6c657420526044820152666567697374727960c81b60648201526084015b60405180910390fd5b600061016261015d8484610961565b610a0b565b6bffffffffffffffffffffffff198116600090815260188701602052604081209192506002820154600160a01b900460ff1660058111156101a5576101a5610e61565b146102185760405162461bcd60e51b815260206004820152602860248201527f45434453412077616c6c657420686173206265656e20616c726561647920726560448201527f67697374657265640000000000000000000000000000000000000000000000006064820152608401610145565b848155600281018054600160a01b63ffffffff42811668010000000000000000027fffffffffffffffffffffff00ffffffffffffffff00000000ffffffffffffffff909316929092178117909255601688018054606086901c73ffffffffffffffffffffffffffffffffffffffff1990911617808255929092041690601461029f83610e8d565b91906101000a81548163ffffffff021916908363ffffffff16021790555050816bffffffffffffffffffffffff1916857f2dbb47dce81d6b11cca1f1e3b10143d6f7e1e7e92d2dd9aacbb1f875379d308e60405160405180910390a3505050505050565b601683015460601b6bffffffffffffffffffffffff1990811690831614156103935760405162461bcd60e51b815260206004820152602c60248201527f4163746976652077616c6c65742063616e6e6f7420626520636f6e736964657260448201527f656420636c6f736561626c6500000000000000000000000000000000000000006064820152608401610145565b6bffffffffffffffffffffffff1982166000908152601884016020526040902060016002820154600160a01b900460ff1660058111156103d5576103d5610e61565b1461042d5760405162461bcd60e51b815260206004820152602260248201527f45434453412077616c6c6574206d75737420626520696e204c69766520737461604482015261746560f01b6064820152608401610145565b6015840154600282015460009161047a9163ffffffff7c01000000000000000000000000000000000000000000000000000000009092048216916801000000000000000090910416610eb1565b63ffffffff16421015905080806104b957506015850154600160a01b900467ffffffffffffffff166104ad868686610a32565b67ffffffffffffffff16105b61052b5760405162461bcd60e51b815260206004820152603660248201527f57616c6c6574206e6565647320746f206265206f6c6420656e6f756768206f7260448201527f206861766520746f6f20666577207361746f73686973000000000000000000006064820152608401610145565b6105358585610b6a565b5050505050565b60028301546001600160a01b031633146105a85760405162461bcd60e51b815260206004820152602760248201527f43616c6c6572206973206e6f74207468652045434453412057616c6c657420526044820152666567697374727960c81b6064820152608401610145565b60006105b761015d8484610961565b905060016bffffffffffffffffffffffff1982166000908152601886016020526040902060020154600160a01b900460ff1660058111156105fa576105fa610e61565b146106525760405162461bcd60e51b815260206004820152602260248201527f45434453412077616c6c6574206d75737420626520696e204c69766520737461604482015261746560f01b6064820152608401610145565b61065c8482610b6a565b50505050565b6002820154604080517fcc56238800000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163cc562388916004808301926020929190829003018186803b1580156106c257600080fd5b505afa1580156106d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106fa9190610ed9565b600381111561070b5761070b610e61565b1461077e5760405162461bcd60e51b815260206004820152602360248201527f57616c6c6574206372656174696f6e20616c726561647920696e2070726f677260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610145565b601682015460601b6bffffffffffffffffffffffff198116156108c95760006107a8848385610a32565b6bffffffffffffffffffffffff1983166000908152601886016020526040812060020154601587015492935063ffffffff680100000000000000009091048116926107f4911683610eb1565b63ffffffff1642101590508080156108265750601586015467ffffffffffffffff640100000000909104811690841610155b806108535750601586015467ffffffffffffffff6c01000000000000000000000000909104811690841610155b6108c55760405162461bcd60e51b815260206004820152602660248201527f57616c6c6574206372656174696f6e20636f6e646974696f6e7320617265206e60448201527f6f74206d657400000000000000000000000000000000000000000000000000006064820152608401610145565b5050505b6040517f31fecb80caf1e1128496dd5a6f1083ba29fd5fe64c3fe04e2d1b6f9cfc27d5a390600090a18260020160009054906101000a90046001600160a01b03166001600160a01b03166372cc8c6d6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561094457600080fd5b505af1158015610958573d6000803e3d6000fd5b50505050505050565b60606000610970600284610f01565b61099b57507f02000000000000000000000000000000000000000000000000000000000000006109be565b507f03000000000000000000000000000000000000000000000000000000000000005b6040517fff00000000000000000000000000000000000000000000000000000000000000821660208201526021810185905260410160405160208183030381529060405291505092915050565b60006020600083516020850160025afa50602060006020600060035afa5050600c51919050565b6bffffffffffffffffffffffff19821660009081526018840160205260408120600101548015610b6257808335610a6f6040860160208701610f23565b610a7f6060870160408801610f49565b604051602001610aec9392919092835260e09190911b7fffffffff0000000000000000000000000000000000000000000000000000000016602083015260c01b7fffffffffffffffff000000000000000000000000000000000000000000000000166024820152602c0190565b6040516020818303038152906040528051906020012014610b4f5760405162461bcd60e51b815260206004820152601d60248201527f496e76616c69642077616c6c6574206d61696e205554584f20646174610000006044820152606401610145565b610b5f6060840160408501610f49565b91505b509392505050565b6bffffffffffffffffffffffff198116600090815260188301602052604090206001810154610ba257610b9d8383610cbf565b610c3a565b60028101805463ffffffff42166c01000000000000000000000000027fffffffffffffffffffffff00ffffffff00000000ffffffffffffffffffffffff909116177402000000000000000000000000000000000000000017905580546040516bffffffffffffffffffffffff19841691907fbdc9ce990a067e5fd3a5d8dfc68e27e9f221aaa3fe55265e0b7e93c460b3efe290600090a35b601683015460601b6bffffffffffffffffffffffff199081169083161415610c7c5760168301805473ffffffffffffffffffffffffffffffffffffffff191690555b601683018054600160a01b900463ffffffff16906014610c9b83610f73565b91906101000a81548163ffffffff021916908363ffffffff16021790555050505050565b6bffffffffffffffffffffffff198116600081815260188401602052604080822060028101805463ffffffff4216700100000000000000000000000000000000027fffffffffffffffffffffff0000000000ffffffffffffffffffffffffffffffff9091161774030000000000000000000000000000000000000000179055805491519093927f68cb496f5e64383745876664ef119840f154a729c03ba866b8aecb5c9f53d51691a3505050565b60008060008060808587031215610d8357600080fd5b5050823594602084013594506040840135936060013592509050565b600060608284031215610db157600080fd5b50919050565b600080600060a08486031215610dcc57600080fd5b8335925060208401356bffffffffffffffffffffffff1981168114610df057600080fd5b9150610dff8560408601610d9f565b90509250925092565b600080600060608486031215610e1d57600080fd5b505081359360208301359350604090920135919050565b60008060808385031215610e4757600080fd5b82359150610e588460208501610d9f565b90509250929050565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600063ffffffff80831681811415610ea757610ea7610e77565b6001019392505050565b600063ffffffff808316818516808303821115610ed057610ed0610e77565b01949350505050565b600060208284031215610eeb57600080fd5b815160048110610efa57600080fd5b9392505050565b600082610f1e57634e487b7160e01b600052601260045260246000fd5b500690565b600060208284031215610f3557600080fd5b813563ffffffff81168114610efa57600080fd5b600060208284031215610f5b57600080fd5b813567ffffffffffffffff81168114610efa57600080fd5b600063ffffffff821680610f8957610f89610e77565b600019019291505056fea264697066735822122096029d789a86d700205ad41f66aeb39f80cd5e687414fe625f63d07730ed954064736f6c63430008090033",
|
|
110
110
|
"linkReferences": {},
|
|
111
111
|
"deployedLinkReferences": {}
|
|
112
112
|
}
|
|
@@ -170,7 +170,9 @@ contract Bridge is Governable, EcdsaWalletOwner {
|
|
|
170
170
|
uint64 redemptionDustThreshold,
|
|
171
171
|
uint64 redemptionTreasuryFeeDivisor,
|
|
172
172
|
uint64 redemptionTxMaxFee,
|
|
173
|
-
uint256 redemptionTimeout
|
|
173
|
+
uint256 redemptionTimeout,
|
|
174
|
+
uint96 redemptionTimeoutSlashingAmount,
|
|
175
|
+
uint256 redemptionTimeoutNotifierRewardMultiplier
|
|
174
176
|
);
|
|
175
177
|
|
|
176
178
|
event MovingFundsParametersUpdated(
|
|
@@ -228,6 +230,8 @@ contract Bridge is Governable, EcdsaWalletOwner {
|
|
|
228
230
|
self.redemptionTreasuryFeeDivisor = 2000; // 1/2000 == 5bps == 0.05% == 0.0005
|
|
229
231
|
self.redemptionTxMaxFee = 10000; // 10000 satoshi
|
|
230
232
|
self.redemptionTimeout = 172800; // 48 hours
|
|
233
|
+
self.redemptionTimeoutSlashingAmount = 10000 * 1e18; // 10000 T
|
|
234
|
+
self.redemptionTimeoutNotifierRewardMultiplier = 100; // 100%
|
|
231
235
|
self.movingFundsTxMaxTotalFee = 10000; // 10000 satoshi
|
|
232
236
|
self.movingFundsTimeout = 7 days;
|
|
233
237
|
self.movingFundsDustThreshold = 20000; // 20000 satoshi
|
|
@@ -436,31 +440,47 @@ contract Bridge is Governable, EcdsaWalletOwner {
|
|
|
436
440
|
/// with the given wallet, that has timed out. The redemption
|
|
437
441
|
/// request is identified by the key built as
|
|
438
442
|
/// `keccak256(walletPubKeyHash | redeemerOutputScript)`.
|
|
439
|
-
/// The results of calling this function:
|
|
440
|
-
/// value for the wallet will be decreased
|
|
441
|
-
///
|
|
442
|
-
///
|
|
443
|
-
///
|
|
444
|
-
///
|
|
445
|
-
///
|
|
446
|
-
///
|
|
447
|
-
///
|
|
448
|
-
///
|
|
449
|
-
///
|
|
443
|
+
/// The results of calling this function:
|
|
444
|
+
/// - the pending redemptions value for the wallet will be decreased
|
|
445
|
+
/// by the requested amount (minus treasury fee),
|
|
446
|
+
/// - the tokens taken from the redeemer on redemption request will
|
|
447
|
+
/// be returned to the redeemer,
|
|
448
|
+
/// - the request will be moved from pending redemptions to
|
|
449
|
+
/// timed-out redemptions.
|
|
450
|
+
/// - if the state of the wallet is `Live` or `MovingFunds`, the
|
|
451
|
+
/// wallet operators will be slashed and the notifier will be
|
|
452
|
+
/// rewarded
|
|
453
|
+
/// - if the state of wallet is `Live`, the wallet will be closed or
|
|
454
|
+
/// marked as `MovingFunds` (depending on the presence or absence
|
|
455
|
+
/// of the wallet's main UTXO) and the wallet will no longer be
|
|
456
|
+
/// marked as the active wallet (if it was marked as such).
|
|
450
457
|
/// @param walletPubKeyHash 20-byte public key hash of the wallet
|
|
458
|
+
/// @param walletMembersIDs Identifiers of the wallet signing group members
|
|
451
459
|
/// @param redeemerOutputScript The redeemer's length-prefixed output
|
|
452
460
|
/// script (P2PKH, P2WPKH, P2SH or P2WSH)
|
|
453
461
|
/// @dev Requirements:
|
|
462
|
+
/// - The wallet must be in the Live or MovingFunds or Terminated state
|
|
454
463
|
/// - The redemption request identified by `walletPubKeyHash` and
|
|
455
464
|
/// `redeemerOutputScript` must exist
|
|
465
|
+
/// - The expression `keccak256(abi.encode(walletMembersIDs))` must
|
|
466
|
+
/// be exactly the same as the hash stored under `membersIdsHash`
|
|
467
|
+
/// for the given `walletID`. Those IDs are not directly stored
|
|
468
|
+
/// in the contract for gas efficiency purposes but they can be
|
|
469
|
+
/// read from appropriate `DkgResultSubmitted` and `DkgResultApproved`
|
|
470
|
+
/// events.
|
|
456
471
|
/// - The amount of time defined by `redemptionTimeout` must have
|
|
457
472
|
/// passed since the redemption was requested (the request must be
|
|
458
473
|
/// timed-out).
|
|
459
474
|
function notifyRedemptionTimeout(
|
|
460
475
|
bytes20 walletPubKeyHash,
|
|
476
|
+
uint32[] calldata walletMembersIDs,
|
|
461
477
|
bytes calldata redeemerOutputScript
|
|
462
478
|
) external {
|
|
463
|
-
self.notifyRedemptionTimeout(
|
|
479
|
+
self.notifyRedemptionTimeout(
|
|
480
|
+
walletPubKeyHash,
|
|
481
|
+
walletMembersIDs,
|
|
482
|
+
redeemerOutputScript
|
|
483
|
+
);
|
|
464
484
|
}
|
|
465
485
|
|
|
466
486
|
/// @notice Submits the moving funds target wallets commitment.
|
|
@@ -906,22 +926,36 @@ contract Bridge is Governable, EcdsaWalletOwner {
|
|
|
906
926
|
/// request was created via `requestRedemption` call. Reported timed
|
|
907
927
|
/// out requests are cancelled and locked TBTC is returned to the
|
|
908
928
|
/// redeemer in full amount.
|
|
929
|
+
/// @param redemptionTimeoutSlashingAmount New value of the redemption
|
|
930
|
+
/// timeout slashing amount in T, it is the amount slashed from each
|
|
931
|
+
/// wallet member for redemption timeout
|
|
932
|
+
/// @param redemptionTimeoutNotifierRewardMultiplier New value of the
|
|
933
|
+
/// redemption timeout notifier reward multiplier as percentage,
|
|
934
|
+
/// it determines the percentage of the notifier reward from the
|
|
935
|
+
/// staking contact the notifier of a redemption timeout receives.
|
|
936
|
+
/// The value must be in the range [0, 100]
|
|
909
937
|
/// @dev Requirements:
|
|
910
938
|
/// - Redemption dust threshold must be greater than zero
|
|
911
939
|
/// - Redemption treasury fee divisor must be greater than zero
|
|
912
940
|
/// - Redemption transaction max fee must be greater than zero
|
|
913
941
|
/// - Redemption timeout must be greater than zero
|
|
942
|
+
/// - Redemption timeout notifier reward multiplier must be in the
|
|
943
|
+
/// range [0, 100]
|
|
914
944
|
function updateRedemptionParameters(
|
|
915
945
|
uint64 redemptionDustThreshold,
|
|
916
946
|
uint64 redemptionTreasuryFeeDivisor,
|
|
917
947
|
uint64 redemptionTxMaxFee,
|
|
918
|
-
uint256 redemptionTimeout
|
|
948
|
+
uint256 redemptionTimeout,
|
|
949
|
+
uint96 redemptionTimeoutSlashingAmount,
|
|
950
|
+
uint256 redemptionTimeoutNotifierRewardMultiplier
|
|
919
951
|
) external onlyGovernance {
|
|
920
952
|
self.updateRedemptionParameters(
|
|
921
953
|
redemptionDustThreshold,
|
|
922
954
|
redemptionTreasuryFeeDivisor,
|
|
923
955
|
redemptionTxMaxFee,
|
|
924
|
-
redemptionTimeout
|
|
956
|
+
redemptionTimeout,
|
|
957
|
+
redemptionTimeoutSlashingAmount,
|
|
958
|
+
redemptionTimeoutNotifierRewardMultiplier
|
|
925
959
|
);
|
|
926
960
|
}
|
|
927
961
|
|
|
@@ -1205,6 +1239,11 @@ contract Bridge is Governable, EcdsaWalletOwner {
|
|
|
1205
1239
|
/// redemption request was created via `requestRedemption` call.
|
|
1206
1240
|
/// Reported timed out requests are cancelled and locked TBTC is
|
|
1207
1241
|
/// returned to the redeemer in full amount.
|
|
1242
|
+
/// @return redemptionTimeoutSlashingAmount The amount of stake slashed
|
|
1243
|
+
/// from each member of a wallet for a redemption timeout.
|
|
1244
|
+
/// @return redemptionTimeoutNotifierRewardMultiplier The percentage of the
|
|
1245
|
+
/// notifier reward from the staking contract the notifier of a
|
|
1246
|
+
/// redemption timeout receives. The value is in the range [0, 100].
|
|
1208
1247
|
function redemptionParameters()
|
|
1209
1248
|
external
|
|
1210
1249
|
view
|
|
@@ -1212,13 +1251,18 @@ contract Bridge is Governable, EcdsaWalletOwner {
|
|
|
1212
1251
|
uint64 redemptionDustThreshold,
|
|
1213
1252
|
uint64 redemptionTreasuryFeeDivisor,
|
|
1214
1253
|
uint64 redemptionTxMaxFee,
|
|
1215
|
-
uint256 redemptionTimeout
|
|
1254
|
+
uint256 redemptionTimeout,
|
|
1255
|
+
uint96 redemptionTimeoutSlashingAmount,
|
|
1256
|
+
uint256 redemptionTimeoutNotifierRewardMultiplier
|
|
1216
1257
|
)
|
|
1217
1258
|
{
|
|
1218
1259
|
redemptionDustThreshold = self.redemptionDustThreshold;
|
|
1219
1260
|
redemptionTreasuryFeeDivisor = self.redemptionTreasuryFeeDivisor;
|
|
1220
1261
|
redemptionTxMaxFee = self.redemptionTxMaxFee;
|
|
1221
1262
|
redemptionTimeout = self.redemptionTimeout;
|
|
1263
|
+
redemptionTimeoutSlashingAmount = self.redemptionTimeoutSlashingAmount;
|
|
1264
|
+
redemptionTimeoutNotifierRewardMultiplier = self
|
|
1265
|
+
.redemptionTimeoutNotifierRewardMultiplier;
|
|
1222
1266
|
}
|
|
1223
1267
|
|
|
1224
1268
|
/// @notice Returns the current values of Bridge moving funds between
|
|
@@ -122,6 +122,13 @@ library BridgeState {
|
|
|
122
122
|
// timed out requests are cancelled and locked TBTC is returned
|
|
123
123
|
// to the redeemer in full amount.
|
|
124
124
|
uint256 redemptionTimeout;
|
|
125
|
+
// The amount of stake slashed from each member of a wallet for a
|
|
126
|
+
// redemption timeout.
|
|
127
|
+
uint96 redemptionTimeoutSlashingAmount;
|
|
128
|
+
// The percentage of the notifier reward from the staking contract
|
|
129
|
+
// the notifier of a redemption timeout receives. The value is in the
|
|
130
|
+
// range [0, 100].
|
|
131
|
+
uint256 redemptionTimeoutNotifierRewardMultiplier;
|
|
125
132
|
// Collection of all pending redemption requests indexed by
|
|
126
133
|
// redemption key built as
|
|
127
134
|
// `keccak256(walletPubKeyHash | redeemerOutputScript)`.
|
|
@@ -222,7 +229,9 @@ library BridgeState {
|
|
|
222
229
|
uint64 redemptionDustThreshold,
|
|
223
230
|
uint64 redemptionTreasuryFeeDivisor,
|
|
224
231
|
uint64 redemptionTxMaxFee,
|
|
225
|
-
uint256 redemptionTimeout
|
|
232
|
+
uint256 redemptionTimeout,
|
|
233
|
+
uint96 redemptionTimeoutSlashingAmount,
|
|
234
|
+
uint256 redemptionTimeoutNotifierRewardMultiplier
|
|
226
235
|
);
|
|
227
236
|
|
|
228
237
|
event MovingFundsParametersUpdated(
|
|
@@ -334,17 +343,29 @@ library BridgeState {
|
|
|
334
343
|
/// request was created via `requestRedemption` call. Reported timed
|
|
335
344
|
/// out requests are cancelled and locked TBTC is returned to the
|
|
336
345
|
/// redeemer in full amount.
|
|
346
|
+
/// @param _redemptionTimeoutSlashingAmount New value of the redemption
|
|
347
|
+
/// timeout slashing amount in T, it is the amount slashed from each
|
|
348
|
+
/// wallet member for redemption timeout
|
|
349
|
+
/// @param _redemptionTimeoutNotifierRewardMultiplier New value of the
|
|
350
|
+
/// redemption timeout notifier reward multiplier as percentage,
|
|
351
|
+
/// it determines the percentage of the notifier reward from the
|
|
352
|
+
/// staking contact the notifier of a redemption timeout receives.
|
|
353
|
+
/// The value must be in the range [0, 100]
|
|
337
354
|
/// @dev Requirements:
|
|
338
355
|
/// - Redemption dust threshold must be greater than zero
|
|
339
356
|
/// - Redemption treasury fee divisor must be greater than zero
|
|
340
357
|
/// - Redemption transaction max fee must be greater than zero
|
|
341
358
|
/// - Redemption timeout must be greater than zero
|
|
359
|
+
/// - Redemption timeout notifier reward multiplier must be in the
|
|
360
|
+
/// range [0, 100]
|
|
342
361
|
function updateRedemptionParameters(
|
|
343
362
|
Storage storage self,
|
|
344
363
|
uint64 _redemptionDustThreshold,
|
|
345
364
|
uint64 _redemptionTreasuryFeeDivisor,
|
|
346
365
|
uint64 _redemptionTxMaxFee,
|
|
347
|
-
uint256 _redemptionTimeout
|
|
366
|
+
uint256 _redemptionTimeout,
|
|
367
|
+
uint96 _redemptionTimeoutSlashingAmount,
|
|
368
|
+
uint256 _redemptionTimeoutNotifierRewardMultiplier
|
|
348
369
|
) internal {
|
|
349
370
|
require(
|
|
350
371
|
_redemptionDustThreshold > 0,
|
|
@@ -366,16 +387,26 @@ library BridgeState {
|
|
|
366
387
|
"Redemption timeout must be greater than zero"
|
|
367
388
|
);
|
|
368
389
|
|
|
390
|
+
require(
|
|
391
|
+
_redemptionTimeoutNotifierRewardMultiplier <= 100,
|
|
392
|
+
"Redemption timeout notifier reward multiplier must be in the range [0, 100]"
|
|
393
|
+
);
|
|
394
|
+
|
|
369
395
|
self.redemptionDustThreshold = _redemptionDustThreshold;
|
|
370
396
|
self.redemptionTreasuryFeeDivisor = _redemptionTreasuryFeeDivisor;
|
|
371
397
|
self.redemptionTxMaxFee = _redemptionTxMaxFee;
|
|
372
398
|
self.redemptionTimeout = _redemptionTimeout;
|
|
399
|
+
self.redemptionTimeoutSlashingAmount = _redemptionTimeoutSlashingAmount;
|
|
400
|
+
self
|
|
401
|
+
.redemptionTimeoutNotifierRewardMultiplier = _redemptionTimeoutNotifierRewardMultiplier;
|
|
373
402
|
|
|
374
403
|
emit RedemptionParametersUpdated(
|
|
375
404
|
_redemptionDustThreshold,
|
|
376
405
|
_redemptionTreasuryFeeDivisor,
|
|
377
406
|
_redemptionTxMaxFee,
|
|
378
|
-
_redemptionTimeout
|
|
407
|
+
_redemptionTimeout,
|
|
408
|
+
_redemptionTimeoutSlashingAmount,
|
|
409
|
+
_redemptionTimeoutNotifierRewardMultiplier
|
|
379
410
|
);
|
|
380
411
|
}
|
|
381
412
|
|
|
@@ -765,29 +765,41 @@ library Redemption {
|
|
|
765
765
|
/// with the given wallet, that has timed out. The redemption
|
|
766
766
|
/// request is identified by the key built as
|
|
767
767
|
/// `keccak256(walletPubKeyHash | redeemerOutputScript)`.
|
|
768
|
-
/// The results of calling this function:
|
|
769
|
-
/// value for the wallet will be decreased
|
|
770
|
-
///
|
|
771
|
-
///
|
|
772
|
-
///
|
|
773
|
-
///
|
|
774
|
-
///
|
|
775
|
-
///
|
|
776
|
-
///
|
|
777
|
-
///
|
|
778
|
-
///
|
|
768
|
+
/// The results of calling this function:
|
|
769
|
+
/// - the pending redemptions value for the wallet will be decreased
|
|
770
|
+
/// by the requested amount (minus treasury fee),
|
|
771
|
+
/// - the tokens taken from the redeemer on redemption request will
|
|
772
|
+
/// be returned to the redeemer,
|
|
773
|
+
/// - the request will be moved from pending redemptions to
|
|
774
|
+
/// timed-out redemptions.
|
|
775
|
+
/// - if the state of the wallet is `Live` or `MovingFunds`, the
|
|
776
|
+
/// wallet operators will be slashed and the notifier will be
|
|
777
|
+
/// rewarded
|
|
778
|
+
/// - if the state of wallet is `Live`, the wallet will be closed or
|
|
779
|
+
/// marked as `MovingFunds` (depending on the presence or absence
|
|
780
|
+
/// of the wallet's main UTXO) and the wallet will no longer be
|
|
781
|
+
/// marked as the active wallet (if it was marked as such).
|
|
779
782
|
/// @param walletPubKeyHash 20-byte public key hash of the wallet
|
|
783
|
+
/// @param walletMembersIDs Identifiers of the wallet signing group members
|
|
780
784
|
/// @param redeemerOutputScript The redeemer's length-prefixed output
|
|
781
785
|
/// script (P2PKH, P2WPKH, P2SH or P2WSH)
|
|
782
786
|
/// @dev Requirements:
|
|
787
|
+
/// - The wallet must be in the Live or MovingFunds or Terminated state
|
|
783
788
|
/// - The redemption request identified by `walletPubKeyHash` and
|
|
784
789
|
/// `redeemerOutputScript` must exist
|
|
790
|
+
/// - The expression `keccak256(abi.encode(walletMembersIDs))` must
|
|
791
|
+
/// be exactly the same as the hash stored under `membersIdsHash`
|
|
792
|
+
/// for the given `walletID`. Those IDs are not directly stored
|
|
793
|
+
/// in the contract for gas efficiency purposes but they can be
|
|
794
|
+
/// read from appropriate `DkgResultSubmitted` and `DkgResultApproved`
|
|
795
|
+
/// events.
|
|
785
796
|
/// - The amount of time defined by `redemptionTimeout` must have
|
|
786
797
|
/// passed since the redemption was requested (the request must be
|
|
787
798
|
/// timed-out).
|
|
788
799
|
function notifyRedemptionTimeout(
|
|
789
800
|
BridgeState.Storage storage self,
|
|
790
801
|
bytes20 walletPubKeyHash,
|
|
802
|
+
uint32[] calldata walletMembersIDs,
|
|
791
803
|
bytes calldata redeemerOutputScript
|
|
792
804
|
) external {
|
|
793
805
|
uint256 redemptionKey = uint256(
|
|
@@ -836,7 +848,17 @@ library Redemption {
|
|
|
836
848
|
) {
|
|
837
849
|
// Propagate timeout consequences to the wallet
|
|
838
850
|
self.notifyWalletTimedOutRedemption(walletPubKeyHash);
|
|
851
|
+
|
|
852
|
+
// Slash the wallet operators and reward the notifier
|
|
853
|
+
self.ecdsaWalletRegistry.seize(
|
|
854
|
+
self.redemptionTimeoutSlashingAmount,
|
|
855
|
+
self.redemptionTimeoutNotifierRewardMultiplier,
|
|
856
|
+
msg.sender,
|
|
857
|
+
wallet.ecdsaWalletID,
|
|
858
|
+
walletMembersIDs
|
|
859
|
+
);
|
|
839
860
|
}
|
|
861
|
+
|
|
840
862
|
// slither-disable-next-line reentrancy-events
|
|
841
863
|
emit RedemptionTimedOut(walletPubKeyHash, redeemerOutputScript);
|
|
842
864
|
|
|
@@ -288,12 +288,11 @@ library Wallets {
|
|
|
288
288
|
moveFunds(self, walletPubKeyHash);
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
-
/// @notice Handles a notification about a wallet redemption timeout
|
|
292
|
-
///
|
|
293
|
-
///
|
|
294
|
-
///
|
|
295
|
-
///
|
|
296
|
-
/// wallet to move their funds.
|
|
291
|
+
/// @notice Handles a notification about a wallet redemption timeout.
|
|
292
|
+
/// Triggers the wallet moving funds process only if the wallet is
|
|
293
|
+
/// still in the Live state. That means multiple action timeouts can
|
|
294
|
+
/// be reported for the same wallet but only the first report
|
|
295
|
+
/// requests the wallet to move their funds.
|
|
297
296
|
/// @param walletPubKeyHash 20-byte public key hash of the wallet
|
|
298
297
|
/// @dev Requirements:
|
|
299
298
|
/// - The wallet must be in the `Live` or `MovingFunds` state
|
|
@@ -314,9 +313,6 @@ library Wallets {
|
|
|
314
313
|
if (walletState == WalletState.Live) {
|
|
315
314
|
moveFunds(self, walletPubKeyHash);
|
|
316
315
|
}
|
|
317
|
-
|
|
318
|
-
// TODO: Perform slashing of wallet operators and transfer some of the
|
|
319
|
-
// slashed tokens to the caller of this function.
|
|
320
316
|
}
|
|
321
317
|
|
|
322
318
|
/// @notice Notifies that the wallet is either old enough or has too few
|
package/export.json
CHANGED
|
@@ -14400,6 +14400,18 @@
|
|
|
14400
14400
|
"internalType": "uint256",
|
|
14401
14401
|
"name": "redemptionTimeout",
|
|
14402
14402
|
"type": "uint256"
|
|
14403
|
+
},
|
|
14404
|
+
{
|
|
14405
|
+
"indexed": false,
|
|
14406
|
+
"internalType": "uint96",
|
|
14407
|
+
"name": "redemptionTimeoutSlashingAmount",
|
|
14408
|
+
"type": "uint96"
|
|
14409
|
+
},
|
|
14410
|
+
{
|
|
14411
|
+
"indexed": false,
|
|
14412
|
+
"internalType": "uint256",
|
|
14413
|
+
"name": "redemptionTimeoutNotifierRewardMultiplier",
|
|
14414
|
+
"type": "uint256"
|
|
14403
14415
|
}
|
|
14404
14416
|
],
|
|
14405
14417
|
"name": "RedemptionParametersUpdated",
|
|
@@ -15059,6 +15071,11 @@
|
|
|
15059
15071
|
"name": "walletPubKeyHash",
|
|
15060
15072
|
"type": "bytes20"
|
|
15061
15073
|
},
|
|
15074
|
+
{
|
|
15075
|
+
"internalType": "uint32[]",
|
|
15076
|
+
"name": "walletMembersIDs",
|
|
15077
|
+
"type": "uint32[]"
|
|
15078
|
+
},
|
|
15062
15079
|
{
|
|
15063
15080
|
"internalType": "bytes",
|
|
15064
15081
|
"name": "redeemerOutputScript",
|
|
@@ -15152,6 +15169,16 @@
|
|
|
15152
15169
|
"internalType": "uint256",
|
|
15153
15170
|
"name": "redemptionTimeout",
|
|
15154
15171
|
"type": "uint256"
|
|
15172
|
+
},
|
|
15173
|
+
{
|
|
15174
|
+
"internalType": "uint96",
|
|
15175
|
+
"name": "redemptionTimeoutSlashingAmount",
|
|
15176
|
+
"type": "uint96"
|
|
15177
|
+
},
|
|
15178
|
+
{
|
|
15179
|
+
"internalType": "uint256",
|
|
15180
|
+
"name": "redemptionTimeoutNotifierRewardMultiplier",
|
|
15181
|
+
"type": "uint256"
|
|
15155
15182
|
}
|
|
15156
15183
|
],
|
|
15157
15184
|
"stateMutability": "view",
|
|
@@ -16109,6 +16136,16 @@
|
|
|
16109
16136
|
"internalType": "uint256",
|
|
16110
16137
|
"name": "redemptionTimeout",
|
|
16111
16138
|
"type": "uint256"
|
|
16139
|
+
},
|
|
16140
|
+
{
|
|
16141
|
+
"internalType": "uint96",
|
|
16142
|
+
"name": "redemptionTimeoutSlashingAmount",
|
|
16143
|
+
"type": "uint96"
|
|
16144
|
+
},
|
|
16145
|
+
{
|
|
16146
|
+
"internalType": "uint256",
|
|
16147
|
+
"name": "redemptionTimeoutNotifierRewardMultiplier",
|
|
16148
|
+
"type": "uint256"
|
|
16112
16149
|
}
|
|
16113
16150
|
],
|
|
16114
16151
|
"name": "updateRedemptionParameters",
|