Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/token/ERC20/Burn/ERC20BurnFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ contract ERC20BurnFacet {
* @dev Emits a {Transfer} event to the zero address.
* @param _value The amount of tokens to burn.
*/
function burnERC20(uint256 _value) external {
function burn(uint256 _value) external {
ERC20Storage storage s = getStorage();
uint256 balance = s.balanceOf[msg.sender];
if (balance < _value) {
Expand All @@ -82,7 +82,7 @@ contract ERC20BurnFacet {
* @param _account The address whose tokens will be burned.
* @param _value The amount of tokens to burn.
*/
function burnERC20From(address _account, uint256 _value) external {
function burnFrom(address _account, uint256 _value) external {
ERC20Storage storage s = getStorage();
uint256 currentAllowance = s.allowance[_account][msg.sender];
if (currentAllowance < _value) {
Expand All @@ -108,6 +108,6 @@ contract ERC20BurnFacet {
* @return selectors The exported function selectors of the ERC20BurnFacet
*/
function exportSelectors() external pure returns (bytes memory) {
return bytes.concat(this.burnERC20.selector, this.burnERC20From.selector);
return bytes.concat(this.burn.selector, this.burnFrom.selector);
}
}
3 changes: 2 additions & 1 deletion src/token/ERC20/Burn/ERC20BurnMod.sol
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@ function getStorage() pure returns (ERC20Storage storage s) {
/**
* @notice Burns tokens from a specified address.
* @dev Decreases both total supply and the sender's balance.
* This module does not perform allowance checks. Ensure proper allowance or authorization validation before calling this function.
* @param _account The address whose tokens will be burned.
* @param _value The number of tokens to burn.
*/
function burnERC20(address _account, uint256 _value) {
function burn(address _account, uint256 _value) {
ERC20Storage storage s = getStorage();
if (_account == address(0)) {
revert ERC20InvalidSender(address(0));
Expand Down
2 changes: 1 addition & 1 deletion src/token/ERC20/Mint/ERC20MintMod.sol
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function getStorage() pure returns (ERC20Storage storage s) {
* @param _account The address receiving the newly minted tokens.
* @param _value The number of tokens to mint.
*/
function mintERC20(address _account, uint256 _value) {
function mint(address _account, uint256 _value) {
ERC20Storage storage s = getStorage();
if (_account == address(0)) {
revert ERC20InvalidReceiver(address(0));
Expand Down
6 changes: 3 additions & 3 deletions src/token/ERC721/Burn/ERC721BurnFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ contract ERC721BurnFacet {
* @notice Burns (destroys) a token, removing it from enumeration tracking.
* @param _tokenId The ID of the token to burn.
*/
function burnERC721(uint256 _tokenId) external {
function burn(uint256 _tokenId) external {
ERC721Storage storage s = getStorage();
address owner = s.ownerOf[_tokenId];
if (owner == address(0)) {
Expand All @@ -77,7 +77,7 @@ contract ERC721BurnFacet {
* @notice Burns (destroys) a token, removing it from enumeration tracking.
* @param _tokenIds The ID of the token to burn.
*/
function burnERC721s(uint256[] memory _tokenIds) external {
function burnBatch(uint256[] memory _tokenIds) external {
ERC721Storage storage s = getStorage();
for (uint256 i; i < _tokenIds.length; i++) {
uint256 tokenId = _tokenIds[i];
Expand Down Expand Up @@ -105,6 +105,6 @@ contract ERC721BurnFacet {
* @return selectors The exported function selectors of the ERC721BurnFacet
*/
function exportSelectors() external pure returns (bytes memory) {
return bytes.concat(this.burnERC721.selector, this.burnERC721s.selector);
return bytes.concat(this.burn.selector, this.burnBatch.selector);
}
}
3 changes: 2 additions & 1 deletion src/token/ERC721/Burn/ERC721BurnMod.sol
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ function getStorage() pure returns (ERC721Storage storage s) {
/**
* @notice Burns (destroys) a specific ERC-721 token.
* @dev Reverts if the token does not exist. Clears ownership and approval.
* This module does not perform approval checks. Ensure proper ownership or approval validation before calling this function.
* @param _tokenId The ID of the token to burn.
*/
function burnERC721(uint256 _tokenId) {
function burn(uint256 _tokenId) {
ERC721Storage storage s = getStorage();
address owner = s.ownerOf[_tokenId];
if (owner == address(0)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ function getERC721Storage() pure returns (ERC721Storage storage s) {

/**
* @notice Burns (destroys) a token, removing it from enumeration tracking.
* @dev This module does not check for approval. Use the facet for approval-checked burns.
* @param _tokenId The ID of the token to burn.
*/
function burn(uint256 _tokenId) {
Expand Down
2 changes: 1 addition & 1 deletion src/token/ERC721/Mint/ERC721MintMod.sol
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function getStorage() pure returns (ERC721Storage storage s) {
* @param _to The address that will own the newly minted token.
* @param _tokenId The ID of the token to mint.
*/
function mintERC721(address _to, uint256 _tokenId) {
function mint(address _to, uint256 _tokenId) {
ERC721Storage storage s = getStorage();
if (_to == address(0)) {
revert ERC721InvalidReceiver(address(0));
Expand Down
4 changes: 2 additions & 2 deletions test/harnesses/token/ERC20/ERC20BurnModHarness.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import "src/token/ERC20/Burn/ERC20BurnMod.sol" as ERC20BurnMod;
*/
contract ERC20BurnModHarness {
/**
* @notice Exposes ERC20BurnMod.burnERC20 as an external function
* @notice Exposes ERC20BurnMod.burn as an external function
*/
function burn(address _account, uint256 _value) external {
ERC20BurnMod.burnERC20(_account, _value);
ERC20BurnMod.burn(_account, _value);
}
}
4 changes: 2 additions & 2 deletions test/harnesses/token/ERC20/ERC20MintModHarness.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import "src/token/ERC20/Mint/ERC20MintMod.sol" as ERC20MintMod;
*/
contract ERC20MintModHarness {
/**
* @notice Exposes ERC20Mod.mintERC20 as an external function
* @notice Exposes ERC20MintMod.mint as an external function
*/
function mint(address _account, uint256 _value) external {
ERC20MintMod.mintERC20(_account, _value);
ERC20MintMod.mint(_account, _value);
}
}
Loading