Remove ESDTRoleBurnForAll role from collection

29 views Asked by At

I created a collection and Anyone -> ESDTRoleBurnForAll role is coming by default.

What does this role do and how can I remove it from the collection?

1

There are 1 answers

0
ROMANIA_engineer On

The role says that anyone can locally burn his/her tokens.

Here you can find a log message:
https://github.com/multiversx/mx-sdk-js-core/blob/feat/next/src/transactionsFactories/tokenManagementTransactionsFactory.ts#L598

You are about to issue (register) a new token. This will set the role "ESDTRoleBurnForAll" (globally).
Once the token is registered, you can unset this role by calling "unsetBurnRoleGlobally" (in a separate transaction).

So, you can unset the role with this transaction:
https://github.com/multiversx/mx-sdk-js-core/blob/feat/next/src/transactionsFactories/tokenManagementTransactionsFactory.ts#L270

createTransactionForUnsettingBurnRoleGlobally(options: {
    sender: IAddress;
    tokenIdentifier: string;
}): TransactionNext {
    const dataParts = ["unsetBurnRoleGlobally", utf8ToHex(options.tokenIdentifier)];

    return new TransactionNextBuilder({
        config: this.config,
        sender: options.sender,
        receiver: Address.fromBech32(ESDT_CONTRACT_ADDRESS),
        dataParts: dataParts,
        gasLimit: this.config.gasLimitToggleBurnRoleGlobally,
        addDataMovementGas: true,
    }).build();
}