-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tweaks to AbstractTBTCDepositor
contract
#779
Conversation
Integrators may be interested in adding more fees to the deposit amount. For this reqson it may be cleanest to calculate im based on the initial deposit amount. By returning the value here they will avoid reading from the storage again.
By changing these functions to public the mock contract can be used by integrators to tweak the contracts to their expectations.
The fee being configurable may be useful for integrators using the stub contract in tests.
Using the value set in the transaction gives integrator a flexibility to test with different deposit values than 10 BTC.
New return parameter was covered in the mock to test the value.
Update calculations of amounts to match the changes made in the mock contracts. The biggest difference is that the funding transaction is no longer hardcoded in the MockBridge contract, but the value in the fixture transaction is used.
The file helps with switching expected node version between the workspaces. lts/hydrogen is node v18, which is the highest node version suported by this module.
Solidity API documentation preview available in the artifacts of the https://github.com/keep-network/tbtc-v2/actions/runs/7743108653 check. |
Result of running `yarn format:fix` command.
Solidity API documentation preview available in the artifacts of the https://github.com/keep-network/tbtc-v2/actions/runs/7743179668 check. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Left one minor comment.
@@ -204,6 +211,8 @@ abstract contract TBTCDepositorProxy { | |||
// slither-disable-next-line reentrancy-no-eth | |||
delete pendingDeposits[depositKey]; | |||
|
|||
initialDepositAmount = deposit.amount * SATOSHI_MULTIPLIER; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's update the usage example from the contract's docstring accordingly. Right now, there is an obsolete version with _finalizeDeposit
returning two parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBTCDepositorProxy
contractAbstractTBTCDepositor
contract
…bstract-depositor-proxy-addons
Solidity API documentation preview available in the artifacts of the https://github.com/keep-network/tbtc-v2/actions/runs/7745366725 check. |
Solidity API documentation preview available in the artifacts of the https://github.com/keep-network/tbtc-v2/actions/runs/7753096823 check. |
Here we remove the rule we added to exclude test contracts from published NPM package. In #779 we prepared a `TestTBTCDepositor` contract to be used by the integrators in tests for mocking the tBTC Bridge contracts. It is useful to include this file in the package, so the integrators can leverage it.
Here we remove the rule we added to exclude test contracts from published NPM package. In #779 we prepared a `TestTBTCDepositor` contract to be used by the integrators in tests for mocking the tBTC Bridge contracts. It is useful to include this file in the package, so the integrators can leverage it.
Refs: #750
In this PR I propose some modifications to the initial implementation of
AbstractTBTCDepositor
contract (#778).Return initial deposit amount from _initializeDeposit function
Integrators may be interested in adding more fees to the deposit amount. For this reason, it may be cleanest to calculate it based on the initial deposit amount. By returning the value here they will avoid the need to read the funding deposit amount from the storage again.
Mock contracts tweaks
I added modifications to the MockBridge and MockTBTCVault contracts, that were useful in tests of the integrator's implementation (thesis/acre#91).