-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #132 from open-format/feature/of-282-deploy-an-erc…
…20-token-to-act-as-oft-on-testnet Feature/of 282 deploy an erc20 token to act as oft on testnet
- Loading branch information
Showing
3 changed files
with
122 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
OPERATIONS_WALLET="0x10CE240074E46579E535506B38A2e6E852c49c8E" | ||
|
||
if [ "${WALLET_ADDRESS}" = "${OPERATIONS_WALLET}" ]; then | ||
echo "Using operator wallet" | ||
else | ||
echo -e "\nWARNING:\nYou are not using the operations wallet." | ||
read -p "Continue? (Y/n): " confirm | ||
if [[ "$confirm" =~ ^[Yy]$ ]]; then | ||
echo "Continuing..." | ||
else | ||
echo "Script aborted." | ||
exit 1 | ||
fi | ||
fi |
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,91 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity ^0.8.16; | ||
|
||
import "forge-std/Script.sol"; | ||
import "forge-std/console.sol"; | ||
import {Utils} from "scripts/utils/Utils.sol"; | ||
import {AppFactory} from "src/factories/App.sol"; | ||
import {ERC20FactoryFacet} from "src/facet/ERC20FactoryFacet.sol"; | ||
import {CONTRACT_NAME as APP_FACTORY} from "scripts/core/AppFactory.s.sol"; | ||
|
||
string constant OPEN_FORMAT_APP = "Open_Format_App"; | ||
string constant OFT = "OFT"; | ||
string constant XP = "XP"; | ||
|
||
contract CreateApp is Script, Utils { | ||
function run() external { | ||
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); | ||
address deployerAddress = vm.addr(deployerPrivateKey); | ||
|
||
vm.startBroadcast(deployerPrivateKey); | ||
address appFactoryAddress = getContractDeploymentAddress(APP_FACTORY); | ||
|
||
if (appFactoryAddress == address(0)) { | ||
revert("Cannot find app factory deployment, make sure it is deployed"); | ||
} | ||
|
||
// create open format app | ||
address openFormatApp = AppFactory(appFactoryAddress).create("Open Format App", deployerAddress); | ||
|
||
vm.stopBroadcast(); | ||
|
||
exportContractDeployment(OPEN_FORMAT_APP, openFormatApp, block.number); | ||
} | ||
} | ||
|
||
contract DeployXP is Script, Utils { | ||
function run() external { | ||
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); | ||
address deployerAddress = vm.addr(deployerPrivateKey); | ||
|
||
address openFormatApp = getContractDeploymentAddress(OPEN_FORMAT_APP); | ||
|
||
if (openFormatApp == address(0)) { | ||
revert("Cannot find open format app, make sure it is created"); | ||
} | ||
|
||
vm.startBroadcast(deployerPrivateKey); | ||
|
||
// deploy XP | ||
address xp = ERC20FactoryFacet(openFormatApp).createERC20( | ||
"XP", | ||
"XP", | ||
18, | ||
0, | ||
"Base" | ||
); | ||
|
||
vm.stopBroadcast(); | ||
|
||
exportContractDeployment(XP, xp, block.number); | ||
} | ||
} | ||
|
||
contract DeployOFT is Script, Utils { | ||
function run() external { | ||
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); | ||
address deployerAddress = vm.addr(deployerPrivateKey); | ||
|
||
address openFormatApp = getContractDeploymentAddress(OPEN_FORMAT_APP); | ||
|
||
if (openFormatApp == address(0)) { | ||
revert("Cannot find open format app, make sure it is created"); | ||
} | ||
|
||
vm.startBroadcast(deployerPrivateKey); | ||
|
||
// deploy OFT | ||
address oft = ERC20FactoryFacet(openFormatApp).createERC20( | ||
"Open Format Token", | ||
"OFT", | ||
18, | ||
100_000, | ||
"Base" | ||
); | ||
|
||
vm.stopBroadcast(); | ||
|
||
exportContractDeployment(OFT, oft, block.number); | ||
} | ||
} | ||
|