-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(evm): erc20 born funtoken: properly burn bank coins after convert…
…ing coin back to erc20 (#2139) Co-authored-by: Unique Divine <[email protected]>
- Loading branch information
1 parent
e5274c0
commit 20531e7
Showing
8 changed files
with
425 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
297 changes: 297 additions & 0 deletions
297
x/evm/embeds/artifacts/contracts/TestERC20TransferWithFee.sol/TestERC20TransferWithFee.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | ||
|
||
contract TestERC20TransferWithFee is ERC20 { | ||
uint256 constant FEE_PERCENTAGE = 10; | ||
|
||
constructor(string memory name, string memory symbol) | ||
ERC20(name, symbol) { | ||
_mint(msg.sender, 1000); | ||
} | ||
|
||
function transfer(address to, uint256 amount) public virtual override returns (bool) { | ||
address owner = _msgSender(); | ||
require(amount > 0, "Transfer amount must be greater than zero"); | ||
|
||
uint256 fee = (amount * FEE_PERCENTAGE) / 100; | ||
uint256 recipientAmount = amount - fee; | ||
|
||
_transfer(owner, address(this), fee); | ||
_transfer(owner, to, recipientAmount); | ||
|
||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters