Untitled Diff

作成日 差分は期限切れになりません
77 削除
446 行
74 追加
428 行
// SPDX-License-Identifier: MIT
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/ERC20.sol)
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/ERC20.sol)


pragma solidity ^0.8.0;
pragma solidity =0.8.7;


import "./IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "./extensions/IERC20MetadataUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol";
import "../../utils/ContextUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";
import "../../proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "../../interfaces/IgETH.sol";


/**
/**
* @dev Implementation of the {IERC20} interface.
* @dev Implementation of the {IERC20} interface.
*
*
* This implementation is agnostic to the way tokens are created. This means
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
*
* TIP: For a detailed writeup see our guide
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
* to implement supply mechanisms].
*
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* conventional and does not conflict with the expectations of ERC20
* applications.
* applications.
*
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
* these events, as it isn't required by the specification.
*
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
* allowances. See {IERC20-approve}.
*/
*/
contract ERC20Upgradeable is

contract ERC20InterfaceUpgradable is
Initializable,
Initializable,
ContextUpgradeable,
ContextUpgradeable,
IERC20Upgradeable,
IERC20Upgradeable,
IERC20MetadataUpgradeable
IERC20MetadataUpgradeable
{
{
mapping(address => uint256) private _balances;
/**
* @dev gETH ERC20 interface doesn't use balance info, catches it from ERC1155.
* mapping(address => uint256) private _balances;
**/


mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => mapping(address => uint256)) private _allowances;


uint256 private _totalSupply;
/**
* @dev gETH ERC20 interface doesn't use totalSupply info, catches it from ERC1155.
* uint256 private _totalSupply;
**/


string private _name;
string private _name;
string private _symbol;
string private _symbol;


uint256 private _id;
IgETH private _ERC1155;

/**
/**
* @dev Sets the values for {name} and {symbol}.
* @dev Sets the values for {name} and {symbol}.
*
*
* The default value of {decimals} is 18. To select a different value for
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
* {decimals} you should overload it.
*
*
* All two of these values are immutable: they can only be set once during
* All two of these values are immutable: they can only be set once during
* construction.
* construction.
*/
*/
function __ERC20_init(string memory name_, string memory symbol_)

internal
function __ERC20interface_init(
onlyInitializing
uint256 id_,
{
string memory name_,
__ERC20_init_unchained(name_, symbol_);
string memory symbol_,
address gETH_1155
) internal onlyInitializing {
__ERC20interface_init_unchained(id_, name_, symbol_, gETH_1155);
}
}


function __ERC20_init_unchained(string memory name_, string memory symbol_)
function __ERC20interface_init_unchained(
internal
uint256 id_,
onlyInitializing
string memory name_,
{
string memory symbol_,
address gETH_1155
) internal onlyInitializing {
_id = id_;
_name = name_;
_name = name_;
_symbol = symbol_;
_symbol = symbol_;
_ERC1155 = IgETH(gETH_1155);
}
}


/**
/**
* @dev Returns the name of the token.
* @dev Returns the name of the token.
*/
*/
function name() public view virtual override returns (string memory) {
function name() public view virtual override returns (string memory) {
return _name;
return _name;
}
}


/**
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
* name.
*/
*/
function symbol() public view virtual override returns (string memory) {
function symbol() public view virtual override returns (string memory) {
return _symbol;
return _symbol;
}
}


/**
/**
* @dev Returns the number of decimals used to get its user representation.
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
* overridden;
*
*
* NOTE: This information is only used for _display_ purposes: it in
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
*/
function decimals() public view virtual override returns (uint8) {
function decimals() public view virtual override returns (uint8) {
return 18;
return 18;
}
}


/**
/**
* @dev See {IERC20-totalSupply}.
* @dev See {IERC20-totalSupply}.