-
Notifications
You must be signed in to change notification settings - Fork 61
Add support for burnable to ERC20, ERC721, and ERC1155 #540
Conversation
src/contracts/nft-drop.ts
Outdated
return { | ||
receipt: await this.contractWrapper.sendTransaction("burn", [tokenId]), | ||
}; | ||
public async burnFromSelf(tokenId: BigNumberish): Promise<TransactionResult> { |
There was a problem hiding this comment.
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
src/core/classes/erc-721-burnable.ts
Outdated
* await contract.nft.burn.fromSelf(tokenId); | ||
* ``` | ||
*/ | ||
public async fromSelf(tokenId: BigNumberish): Promise<TransactionResult> { |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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
src/contracts/edition.ts
Outdated
amount, | ||
]), | ||
}; | ||
return this._burn.fromSelf(tokenId, amount); |
There was a problem hiding this comment.
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
?
src/contracts/token-drop.ts
Outdated
* await contract.burnFrom(holderAddress, amount); | ||
* ``` | ||
*/ | ||
public async burnFrom( |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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", [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
src/contracts/token.ts
Outdated
]), | ||
}; | ||
public async burnTokens(amount: Amount): Promise<TransactionResult> { | ||
return this._burn.fromSelf(amount); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still called fromSelf
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shipit
No description provided.