made names all generic
This commit is contained in:
parent
fa4ede8fbc
commit
2d0702934f
|
@ -14,10 +14,10 @@ import "erc-payable-token/contracts/token/ERC1363/IERC1363.sol";
|
||||||
import "erc-payable-token/contracts/token/ERC1363/IERC1363Spender.sol";
|
import "erc-payable-token/contracts/token/ERC1363/IERC1363Spender.sol";
|
||||||
import "erc-payable-token/contracts/token/ERC1363/IERC1363Receiver.sol";
|
import "erc-payable-token/contracts/token/ERC1363/IERC1363Receiver.sol";
|
||||||
|
|
||||||
abstract contract AbstractGrans is IERC1363, ERC20, ERC20Burnable, Pausable, Ownable, ERC20Permit, ERC20Votes, ERC20FlashMint {
|
abstract contract AbstractToken is IERC1363, ERC20, ERC20Burnable, Pausable, Ownable, ERC20Permit, ERC20Votes, ERC20FlashMint {
|
||||||
using Address for address;
|
using Address for address;
|
||||||
|
|
||||||
constructor() ERC20("10Grans", "GRANS") ERC20Permit("10Grans") {}
|
constructor(string memory _name, string memory _symbol) ERC20(_name, _symbol) ERC20Permit(_name) {}
|
||||||
|
|
||||||
function pause() public onlyOwner {
|
function pause() public onlyOwner {
|
||||||
_pause();
|
_pause();
|
|
@ -0,0 +1,11 @@
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
pragma solidity ^0.8.19;
|
||||||
|
|
||||||
|
import "./AbstractToken.sol";
|
||||||
|
|
||||||
|
contract L1Token is AbstractToken {
|
||||||
|
|
||||||
|
constructor(string memory _name, string memory _symbol, uint256 _fixedMint) AbstractToken(_name, _symbol) {
|
||||||
|
_mint(msg.sender, _fixedMint * 10 ** 18);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
pragma solidity ^0.8.19;
|
pragma solidity ^0.8.19;
|
||||||
|
|
||||||
import "./TenGransAbstractToken.sol";
|
import "./AbstractToken.sol";
|
||||||
import "@eth-optimism/contracts-bedrock/contracts/universal/IOptimismMintableERC20.sol";
|
import "@eth-optimism/contracts-bedrock/contracts/universal/IOptimismMintableERC20.sol";
|
||||||
|
|
||||||
contract TenGransBaseToken is AbstractGrans, IOptimismMintableERC20 {
|
contract L2Token is AbstractToken, IOptimismMintableERC20 {
|
||||||
/// @notice Address of the corresponding version of this token on the remote chain.
|
/// @notice Address of the corresponding version of this token on the remote chain.
|
||||||
address public immutable REMOTE_TOKEN;
|
address public immutable REMOTE_TOKEN;
|
||||||
|
|
||||||
|
@ -27,17 +27,17 @@ contract TenGransBaseToken is AbstractGrans, IOptimismMintableERC20 {
|
||||||
_;
|
_;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(address _bridge, address _remoteToken) AbstractGrans() {
|
constructor(string memory _name, string memory _symbol, address _bridge, address _remoteToken) AbstractToken(_name, _symbol) {
|
||||||
BRIDGE = _bridge;
|
BRIDGE = _bridge;
|
||||||
REMOTE_TOKEN = _remoteToken;
|
REMOTE_TOKEN = _remoteToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
function balanceOf(address account) public view virtual override(AbstractGrans) returns (uint256) {
|
function balanceOf(address account) public view virtual override(AbstractToken) returns (uint256) {
|
||||||
return AbstractGrans.balanceOf(account);
|
return AbstractToken.balanceOf(account);
|
||||||
}
|
}
|
||||||
|
|
||||||
function transferFrom(address sender, address recipient, uint256 amount) public virtual override(AbstractGrans) returns (bool) {
|
function transferFrom(address sender, address recipient, uint256 amount) public virtual override(AbstractToken) returns (bool) {
|
||||||
return AbstractGrans.transferFrom(sender, recipient, amount);
|
return AbstractToken.transferFrom(sender, recipient, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @notice Allows the StandardBridge on this network to mint tokens.
|
/// @notice Allows the StandardBridge on this network to mint tokens.
|
||||||
|
@ -75,7 +75,7 @@ contract TenGransBaseToken is AbstractGrans, IOptimismMintableERC20 {
|
||||||
/// @notice ERC165 interface check function.
|
/// @notice ERC165 interface check function.
|
||||||
/// @param _interfaceId Interface ID to check.
|
/// @param _interfaceId Interface ID to check.
|
||||||
/// @return Whether or not the interface is supported by this contract.
|
/// @return Whether or not the interface is supported by this contract.
|
||||||
function supportsInterface(bytes4 _interfaceId) public pure virtual override(AbstractGrans, IERC165) returns (bool) {
|
function supportsInterface(bytes4 _interfaceId) public pure virtual override(AbstractToken, IERC165) returns (bool) {
|
||||||
bytes4 iface1 = type(IERC165).interfaceId;
|
bytes4 iface1 = type(IERC165).interfaceId;
|
||||||
// Interface corresponding to the updated OptimismMintableERC20 (this contract).
|
// Interface corresponding to the updated OptimismMintableERC20 (this contract).
|
||||||
bytes4 iface2 = type(IOptimismMintableERC20).interfaceId;
|
bytes4 iface2 = type(IOptimismMintableERC20).interfaceId;
|
|
@ -1,11 +0,0 @@
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
pragma solidity ^0.8.19;
|
|
||||||
|
|
||||||
import "./TenGransAbstractToken.sol";
|
|
||||||
|
|
||||||
contract TenGransEthToken is AbstractGrans {
|
|
||||||
|
|
||||||
constructor() AbstractGrans() {
|
|
||||||
_mint(msg.sender, 15_000 * 10 ** 18);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,32 +0,0 @@
|
||||||
import { ethers } from "hardhat";
|
|
||||||
import fs from "fs/promises";
|
|
||||||
import dotenv from "dotenv";
|
|
||||||
const env = process.env.NODE_ENV || "local";
|
|
||||||
dotenv.config({ path: `.env.${env}` });
|
|
||||||
|
|
||||||
async function main() {
|
|
||||||
if (!process.env.BASE_BRIDGE_ADDRESS) throw "Bridge address not defined";
|
|
||||||
const tenGransAddress = (await fs.readFile(`.10grans-eth-address.${env}`, "utf-8")).trim();
|
|
||||||
|
|
||||||
const TENGRANS = await ethers.deployContract(
|
|
||||||
"TenGransBaseToken",
|
|
||||||
[
|
|
||||||
process.env.BASE_BRIDGE_ADDRESS,
|
|
||||||
tenGransAddress
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
await TENGRANS.waitForDeployment();
|
|
||||||
const deployedAddress = await TENGRANS.getAddress();
|
|
||||||
|
|
||||||
console.log(`Base 10grans deployed to: ${deployedAddress}`);
|
|
||||||
await fs.writeFile(`.10grans-base-address.${env}`, deployedAddress);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// We recommend this pattern to be able to use async/await everywhere
|
|
||||||
// and properly handle errors.
|
|
||||||
main().catch((error) => {
|
|
||||||
console.error(error);
|
|
||||||
process.exitCode = 1;
|
|
||||||
});
|
|
|
@ -1,20 +0,0 @@
|
||||||
import { ethers } from "hardhat";
|
|
||||||
import fs from "fs/promises";
|
|
||||||
const env = process.env.NODE_ENV || "local";
|
|
||||||
|
|
||||||
async function main() {
|
|
||||||
const TENGRANS = await ethers.deployContract("TenGransEthToken");
|
|
||||||
|
|
||||||
await TENGRANS.waitForDeployment();
|
|
||||||
const deployedAddress = await TENGRANS.getAddress();
|
|
||||||
|
|
||||||
console.log(`Ethereum 10grans deployed to: ${deployedAddress}`);
|
|
||||||
await fs.writeFile(`.10grans-eth-address.${env}`, deployedAddress);
|
|
||||||
}
|
|
||||||
|
|
||||||
// We recommend this pattern to be able to use async/await everywhere
|
|
||||||
// and properly handle errors.
|
|
||||||
main().catch((error) => {
|
|
||||||
console.error(error);
|
|
||||||
process.exitCode = 1;
|
|
||||||
});
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
import { ethers } from "hardhat";
|
||||||
|
import fs from "fs/promises";
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
const env = process.env.NODE_ENV || "local";
|
||||||
|
|
||||||
|
if (!process.env.TOKEN_NAME) throw "Token name not defined";
|
||||||
|
if (!process.env.TOKEN_SYMBOL) throw "Token symbol not defined";
|
||||||
|
if (!process.env.TOKEN_AMOUNT) throw "Token amount not defined";
|
||||||
|
|
||||||
|
const tokenAmount = parseInt(process.env.TOKEN_AMOUNT);
|
||||||
|
|
||||||
|
const L1Token = await ethers.deployContract(
|
||||||
|
"L1Token",
|
||||||
|
[
|
||||||
|
process.env.TOKEN_NAME,
|
||||||
|
process.env.TOKEN_SYMBOL,
|
||||||
|
tokenAmount,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
await L1Token.waitForDeployment();
|
||||||
|
const deployedAddress = await L1Token.getAddress();
|
||||||
|
|
||||||
|
console.log(`L1 token deployed to: ${deployedAddress}`);
|
||||||
|
await fs.writeFile(`.l1-token-address.${env}`, deployedAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
// We recommend this pattern to be able to use async/await everywhere
|
||||||
|
// and properly handle errors.
|
||||||
|
main().catch((error) => {
|
||||||
|
console.error(error);
|
||||||
|
process.exitCode = 1;
|
||||||
|
});
|
|
@ -0,0 +1,36 @@
|
||||||
|
import { ethers } from "hardhat";
|
||||||
|
import fs from "fs/promises";
|
||||||
|
import dotenv from "dotenv";
|
||||||
|
const env = process.env.NODE_ENV || "local";
|
||||||
|
dotenv.config({ path: `.env.${env}` });
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
if (!process.env.BASE_BRIDGE_ADDRESS) throw "Bridge address not defined";
|
||||||
|
if (!process.env.TOKEN_NAME) throw "Token name not defined";
|
||||||
|
if (!process.env.TOKEN_SYMBOL) throw "Token symbol not defined";
|
||||||
|
|
||||||
|
const L1TokenAddress = (await fs.readFile(`.l1-token-address.${env}`, "utf-8")).trim();
|
||||||
|
|
||||||
|
const L2Token = await ethers.deployContract(
|
||||||
|
"L2Token",
|
||||||
|
[
|
||||||
|
process.env.TOKEN_NAME,
|
||||||
|
process.env.TOKEN_SYMBOL,
|
||||||
|
process.env.BASE_BRIDGE_ADDRESS,
|
||||||
|
L1TokenAddress,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
await L2Token.waitForDeployment();
|
||||||
|
const deployedAddress = await L2Token.getAddress();
|
||||||
|
|
||||||
|
console.log(`L2 token deployed to: ${deployedAddress}`);
|
||||||
|
await fs.writeFile(`.l2-token-address.${env}`, deployedAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
// We recommend this pattern to be able to use async/await everywhere
|
||||||
|
// and properly handle errors.
|
||||||
|
main().catch((error) => {
|
||||||
|
console.error(error);
|
||||||
|
process.exitCode = 1;
|
||||||
|
});
|
Loading…
Reference in New Issue