Skip to content
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

chore: update MADs precompile contract #3

Merged
merged 2 commits into from
Jan 20, 2025
Merged

Conversation

shekohex
Copy link
Contributor

This pull request includes several changes focusing on the MultiAssetDelegation interface and related contracts. The main updates involve adding custom selectors to functions, modifying the balance retrieval logic, and updating the mock contract for testing purposes.

Interface Updates:

  • Added @custom:selector annotations to all functions in the MultiAssetDelegation interface to specify their selectors. [1] [2] [3]

Balance Retrieval:

  • Introduced a new internal function _balanceOf in TangleMultiAssetDelegationWrapper to get the current balance of a delegator.
  • Updated the totalAssets function in TangleLiquidRestakingVault to use _balanceOf instead of asset.balanceOf.

Mock Contract Updates:

  • Modified MockMultiAssetDelegation to include a constructor that accepts an ERC20 token and added functions to retrieve balances. [1] [2] [3]
  • Updated the MockMultiAssetDelegation contract to track delegated amounts and return balances accordingly.

Testing Updates:

  • Updated the TangleLiquidRestakingVaultTest to initialize MockMultiAssetDelegation with a base token.

Closes #2

@shekohex shekohex requested a review from drewstone January 20, 2025 16:07
@shekohex
Copy link
Contributor Author

Needs: tangle-network/tangle#885

Copy link

LCOV of commit 2721e50 during CI #13

Summary coverage rate:
  lines......: 81.1% (215 of 265 lines)
  functions..: 66.1% (41 of 62 functions)
  branches...: 68.4% (13 of 19 branches)

Files changed coverage rate:
                                           |Lines       |Functions  |Branches    
  Filename                                 |Rate     Num|Rate    Num|Rate     Num
  ===============================================================================
  src/TangleLiquidRestakingVault.sol       |18.5%    135| 100%    19|    -      0
  src/TangleMultiAssetDelegationWrapper.sol|37.0%     27| 0.0%    10|    -      0
  test/mock/MockMultiAssetDelegation.sol   |49.0%     51| 0.0%    11|    -      0

@drewstone drewstone merged commit 2c28ec0 into main Jan 20, 2025
2 checks passed
@shekohex shekohex deleted the shady/mads-update branch January 20, 2025 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Divide by Zero during scheduleUnstake.
2 participants