-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(): fix regression of
4.0.0 beta13
(#2159)
<!-- Thanks for sending a pull request! --> #### What this PR does / why we need it: #### Which issue(s) does this PR fixes?: <!-- (Optional) Automatically closes linked issue when PR is merged. Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`. --> Fixes # #### Additional comments?:
- Loading branch information
1 parent
950b21c
commit 4b4724c
Showing
8 changed files
with
639 additions
and
556 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
This file was deleted.
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,126 @@ | ||
// File: @openzeppelin/[email protected]/token/ERC20/IERC20.sol | ||
|
||
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
/** | ||
* @dev Interface for the optional metadata functions from the ERC20 standard. | ||
* | ||
* _Available since v4.1._ | ||
*/ | ||
interface IERC20Metadata { | ||
/** | ||
* @dev Returns the name of the token. | ||
*/ | ||
function name() external view returns (string memory); | ||
|
||
/** | ||
* @dev Returns the symbol of the token. | ||
*/ | ||
function symbol() external view returns (string memory); | ||
|
||
/** | ||
* @dev Returns the decimals places of the token. | ||
*/ | ||
function decimals() external view returns (uint8); | ||
} | ||
|
||
interface IERC20 { | ||
function transferFrom( | ||
address from, | ||
address to, | ||
uint256 amount | ||
) external returns (bool); | ||
} | ||
|
||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
/** | ||
* @title TransferDomain | ||
*/ | ||
contract TransferDomainV1 is IERC20Metadata { | ||
mapping(address => uint256) private _balances; | ||
uint256 private _totalSupply; | ||
|
||
event Transfer(address indexed from, address indexed to, uint256 amount); | ||
event VMTransfer(string vmAddress); | ||
|
||
function transfer( | ||
address from, | ||
address payable to, | ||
uint256 amount, | ||
string memory vmAddress | ||
) external { | ||
if (to != address(this)) { | ||
require( | ||
address(this).balance >= amount, | ||
"Insufficient contract balance" | ||
); | ||
|
||
to.transfer(amount); | ||
} | ||
|
||
emit Transfer(from, to, amount); | ||
emit VMTransfer(vmAddress); | ||
} | ||
|
||
/** | ||
* @dev Returns the name of the token. | ||
*/ | ||
function name() public view virtual override returns (string memory) { | ||
return "TransferDomain"; | ||
} | ||
|
||
/** | ||
* @dev Returns the symbol of the token, usually a shorter version of the | ||
* name. | ||
*/ | ||
function symbol() public view virtual override returns (string memory) { | ||
return "DFI"; | ||
} | ||
|
||
/** | ||
* @dev Returns the number of decimals used to get its user representation. | ||
* For example, if `decimals` equals `2`, a balance of `505` tokens should | ||
* be displayed to a user as `5.05` (`505 / 10 ** 2`). | ||
* | ||
* Tokens usually opt for a value of 18, imitating the relationship between | ||
* Ether and Wei. This is the default value returned by this function, unless | ||
* it's overridden. | ||
* | ||
* NOTE: This information is only used for _display_ purposes: it in | ||
* no way affects any of the arithmetic of the contract, including | ||
* {IERC20-balanceOf} and {IERC20-transfer}. | ||
*/ | ||
function decimals() public view virtual override returns (uint8) { | ||
return 18; | ||
} | ||
|
||
function transferDST20( | ||
address contractAddress, | ||
address from, | ||
address payable to, | ||
uint256 amount, | ||
string memory vmAddress | ||
) external { | ||
IERC20(contractAddress).transferFrom(from, to, amount); | ||
emit VMTransfer(vmAddress); | ||
} | ||
|
||
/** | ||
* @dev See {IERC20-totalSupply}. | ||
*/ | ||
function totalSupply() public view virtual returns (uint256) { | ||
return _totalSupply; | ||
} | ||
|
||
/** | ||
* @dev See {IERC20-balanceOf}. | ||
*/ | ||
function balanceOf(address account) public view virtual returns (uint256) { | ||
return _balances[account]; | ||
} | ||
} |
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
Oops, something went wrong.