Skip to content

Token: burn_self is a byte-for-byte duplicate of burn #350

Description

@zachyo

File: contracts/token/src/lib.rs lines 147 to 153 versus lines 215 to 221

Issue: Identical guards, identical body, identical intent. The two doc comments even repeat the same sentence about not letting a holder dodge a freeze:

pub fn burn(env: Env, from: Address, amount: i128) {
    Self::_check_paused(&env);
    from.require_auth();
    assert!(amount > 0, "amount must be positive");
    assert!(!Self::_is_frozen(&env, &from), "account is frozen");
    Self::_burn(&env, &from, amount);
}

burn_self is the same five lines. Two names for one behaviour doubles the entry-point surface that every future guard change must be applied to consistently, which is exactly the drift that produced [96], and it confuses SEP-41 clients about which entry point is canonical. It also inflates WASM size for nothing.

Fix: Delete burn_self and keep the standard-named burn. If the name is already deployed somewhere and must be preserved, make it a one-line delegate to Self::burn.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions