Skip to content

Refactor burn native tokens method#123

Merged
Mike-CZ merged 15 commits intomainfrom
mike/burn_native_tokens
Jan 27, 2025
Merged

Refactor burn native tokens method#123
Mike-CZ merged 15 commits intomainfrom
mike/burn_native_tokens

Conversation

@Mike-CZ
Copy link
Collaborator

@Mike-CZ Mike-CZ commented Dec 16, 2024

No description provided.

@Mike-CZ Mike-CZ requested review from jmpike and thaarok December 16, 2024 15:29
thaarok
thaarok previously approved these changes Dec 16, 2024
@Mike-CZ Mike-CZ changed the base branch from mike/disable_initializers to main December 17, 2024 06:56
@Mike-CZ Mike-CZ dismissed thaarok’s stale review December 17, 2024 06:56

The base branch was changed.

@Mike-CZ Mike-CZ requested a review from thaarok December 17, 2024 06:56
function _burnFTM(uint256 amount) internal {
if (amount != 0) {
function _burnNativeTokens(uint256 amount) internal {
if (amount != 0 && totalSupply >= amount) {

Choose a reason for hiding this comment

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

if amount > totalSupply you could also do amount = totalSupply; and then burn that amount

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

replaced with revert

totalSupply -= amount;
payable(address(0)).transfer(amount);
emit BurntFTM(amount);
emit BurntNativeTokens(amount);

Choose a reason for hiding this comment

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

you could also use call instead of transfer

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is pending in #111

@Mike-CZ Mike-CZ merged commit 05eba01 into main Jan 27, 2025
@Mike-CZ Mike-CZ deleted the mike/burn_native_tokens branch January 27, 2025 09:51
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.

3 participants