File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -21,17 +21,20 @@ contract CrosschainERC677 is ERC20Burnable, IERC677 {
2121 _;
2222 }
2323
24+ ERC20Burnable public immutable legacyToken;
2425 ERC20 public coToken;
2526 address public minter;
2627 uint8 private decimals_;
2728
2829 constructor (
30+ ERC20Burnable _legacyToken ,
2931 ERC20 _coToken ,
3032 address _minter ,
3133 string memory _name ,
3234 string memory _symbol ,
3335 uint8 _decimals
3436 ) ERC20 (_name, _symbol) {
37+ legacyToken = _legacyToken;
3538 coToken = _coToken;
3639 minter = _minter;
3740 decimals_ = _decimals;
@@ -71,6 +74,11 @@ contract CrosschainERC677 is ERC20Burnable, IERC677 {
7174 coToken.safeTransfer (_to, _amount);
7275 }
7376
77+ function exchange (uint256 _amount ) public {
78+ require (legacyToken.burnFrom (msg .sender , _amount), "burn failed " );
79+ _mint (msg .sender , _amount);
80+ }
81+
7482 function mint (address _to , uint256 _amount ) public onlyMinter returns (bool ) {
7583 require (_amount != 0 , "amount is 0 " );
7684 _mint (_to, _amount);
You can’t perform that action at this time.
0 commit comments