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

Implement TryFrom<String> for PrincipalData #300

Merged
merged 11 commits into from
Oct 21, 2023

Conversation

friedger
Copy link
Collaborator

@friedger friedger commented Oct 17, 2023

Summary of Changes

This PR implements conversion from string to principal data that is used by the sbtc cli to enable deposits to stacks contracts.

Fixes #299

Testing

Risks

This enables users to deposit sbtc to a contract without any checks whether the contract exists or can handle recieved sbtc tokens.

How were these changes tested?

  • unit test added
  • manual test in devenv (with non-existing contract)

Screenshot from 2023-10-17 21-57-48

What future testing should occur?

Integration test

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@friedger
Copy link
Collaborator Author

While there is a risk to loose sbtc by sending to a contract, this possibility might inspire developers at the hackathon.

@codecov
Copy link

codecov bot commented Oct 17, 2023

Codecov Report

Merging #300 (74ea7df) into main (eac5a87) will increase coverage by 0.59%.
Report is 4 commits behind head on main.
The diff coverage is 86.56%.

@@            Coverage Diff             @@
##             main     #300      +/-   ##
==========================================
+ Coverage   43.12%   43.71%   +0.59%     
==========================================
  Files          45       45              
  Lines        5359     5433      +74     
  Branches       47       47              
==========================================
+ Hits         2311     2375      +64     
- Misses       3047     3057      +10     
  Partials        1        1              
Flag Coverage Δ
unittests 76.61% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
stacks-core/src/lib.rs 34.21% <ø> (+2.63%) ⬆️
sbtc-cli/src/commands/deposit.rs 0.00% <0.00%> (ø)
stacks-core/src/crypto/wif.rs 61.97% <0.00%> (ø)
stacks-core/src/utils.rs 95.71% <92.06%> (-1.57%) ⬇️

... and 5 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@stjepangolemac stjepangolemac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good but let's make it a bit more idiomatic and then merge.

sbtc-cli/src/commands/deposit.rs Show resolved Hide resolved
stacks-core/src/utils.rs Outdated Show resolved Hide resolved
stjepangolemac
stjepangolemac previously approved these changes Oct 18, 2023
stacks-core/src/utils.rs Outdated Show resolved Hide resolved
stjepangolemac
stjepangolemac previously approved these changes Oct 18, 2023
@friedger friedger changed the title Implement From<String> for PrincipalData Implement TryFrom<String> for PrincipalData Oct 18, 2023
stacks-core/src/utils.rs Outdated Show resolved Hide resolved
stacks-core/src/utils.rs Outdated Show resolved Hide resolved
stacks-core/src/utils.rs Outdated Show resolved Hide resolved
AshtonStephens
AshtonStephens previously approved these changes Oct 20, 2023
Co-authored-by: Carlos Alejandro Gutierrez Sandoval <[email protected]>
CAGS295
CAGS295 previously approved these changes Oct 20, 2023
@AshtonStephens AshtonStephens merged commit 56dd8ff into main Oct 21, 2023
8 checks passed
@AshtonStephens AshtonStephens deleted the 299-deposit-to-contract branch October 21, 2023 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add support for deposit to contract
4 participants