Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

Add support for burnable to ERC20, ERC721, and ERC1155 #540

Merged
merged 9 commits into from
Aug 11, 2022
Merged

Conversation

adam-maj
Copy link
Contributor

No description provided.

return {
receipt: await this.contractWrapper.sendTransaction("burn", [tokenId]),
};
public async burnFromSelf(tokenId: BigNumberish): Promise<TransactionResult> {
Copy link
Member

Choose a reason for hiding this comment

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

let's call this burnToken(tokenId) reads much nicer

* await contract.nft.burn.fromSelf(tokenId);
* ```
*/
public async fromSelf(tokenId: BigNumberish): Promise<TransactionResult> {
Copy link
Member

Choose a reason for hiding this comment

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

let's also call this token(tokenId)

so it goes contract.nft.burn.token(tokenId)

@@ -270,11 +268,6 @@ export class Token extends Erc20<TokenERC20> {
holder: string,
Copy link
Member

Choose a reason for hiding this comment

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

let's get rid of this function, it's just confusing and has almost no value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Feels odd to remove this (assuming you're referring to burnFrom because its the only function on the token interface that calls the burnFrom function on the contract: https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/ad67d48f0914a15a9350ef42672322058b48d5b1/contracts/token/ERC20/extensions/ERC20BurnableUpgradeable.sol#L41

Also, it's existed on our token contract for a long time now. We should probably have contract interface for the functions on the contract right? Otherwise just shouldn't be on the contract if it really has no use (but since OZ has it, maybe people use it for something).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will delete anyway for now

amount,
]),
};
return this._burn.fromSelf(tokenId, amount);
Copy link
Member

Choose a reason for hiding this comment

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

this one is still fromSelf ?

* await contract.burnFrom(holderAddress, amount);
* ```
*/
public async burnFrom(
Copy link
Member

Choose a reason for hiding this comment

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

thinking more about it, maybe we leave this just in case, never know what weird usecases ppl have. Lets' leave this but not expose it in the extension.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's only two functions in the extension though - burn and burnFrom. Isn't it odd to only support one of them if someone intentionally implemented?

amount: Amount,
): Promise<TransactionResult> {
return {
receipt: await this.contractWrapper.sendTransaction("burnFrom", [
Copy link
Member

Choose a reason for hiding this comment

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

same here

]),
};
public async burnTokens(amount: Amount): Promise<TransactionResult> {
return this._burn.fromSelf(amount);
Copy link
Member

Choose a reason for hiding this comment

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

still called fromSelf here

Copy link
Member

@joaquim-verges joaquim-verges left a comment

Choose a reason for hiding this comment

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

shipit

@adam-maj adam-maj merged commit 39dc804 into main Aug 11, 2022
@adam-maj adam-maj deleted the am/burnable branch August 11, 2022 21:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants