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

Simplify Asset Transfer and Mint Functions #5891

Merged
merged 10 commits into from
Apr 25, 2024
Merged

Simplify Asset Transfer and Mint Functions #5891

merged 10 commits into from
Apr 25, 2024

Conversation

bitzoic
Copy link
Member

@bitzoic bitzoic commented Apr 23, 2024

Description

There are currently multiple functions for the same functionality:

Transfer:

  • transfer()
  • force_transfer_to_contract()
  • transfer_to_address()

Mint:

  • mint()
  • mint_to()
  • mint_to_contract()
  • mint_to_address()

This be reduced to just transfer(), mint(), mint_to(). Specific functions for separately minting and transferring to contracts and addresses are legacy code left over from before the Identity type was introduced and now only adds additional complexity.

Changes:

  • force_transfer_to_contract() is now private
  • transfer_to_address() is now private
  • mint_to_contract() removed
  • mint_to_address() removed
  • Removed newlines in inline docs for better forc doc compatibility
  • Updated burn() inline docs

Breaking Changes:

  • force_transfer_to_contract() is now private
  • transfer_to_address() is now private
  • mint_to_contract() removed
  • mint_to_address() removed

Closes

Checklist

  • I have linked to any relevant issues.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation where relevant (API docs, the reference, and the Sway book).
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added (or requested a maintainer to add) the necessary Breaking* or New Feature labels where relevant.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

@bitzoic bitzoic added lib: std Standard library breaking May cause existing user code to break. Requires a minor or major release. labels Apr 23, 2024
@bitzoic bitzoic self-assigned this Apr 23, 2024
@bitzoic bitzoic requested a review from a team April 23, 2024 05:19
@IGI-111 IGI-111 merged commit dbdcd62 into master Apr 25, 2024
39 checks passed
@IGI-111 IGI-111 deleted the bitzoic-5773 branch April 25, 2024 14:39
@SwayStar123
Copy link
Member

Isnt this forcing an additional match statement for some situations that might not need one? The previous functions could have been used for gas golfing where it is known whether the transfer is going to be to a contract or address beforehand

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking May cause existing user code to break. Requires a minor or major release. lib: std Standard library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simplify asset transfer functions and make force transfer functions private
5 participants