Skip to content

Commit

Permalink
Deploy script for fake USDC (#693)
Browse files Browse the repository at this point in the history
  • Loading branch information
penandlim committed Aug 31, 2022
1 parent 7a1e6f4 commit b3a4aca
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions deploy/hardhat/640_deploy_fake_USDC.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { BigNumber } from "ethers"
import { DeployFunction } from "hardhat-deploy/types"
import { HardhatRuntimeEnvironment } from "hardhat/types"
import { isTestNetwork } from "../../utils/network"

const TOKENS_ARGS: { [token: string]: any[] } = {
USDC_FAKE: ["USD coin", "USDC", "6"],
}

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts, getChainId } = hre
const { deploy, execute } = deployments
const { deployer } = await getNamedAccounts()

for (const token in TOKENS_ARGS) {
await deploy(token, {
from: deployer,
log: true,
contract: "GenericERC20",
args: TOKENS_ARGS[token],
skipIfAlreadyDeployed: true,
})
// If it's on hardhat, mint test tokens
if (isTestNetwork(await getChainId())) {
const decimals = TOKENS_ARGS[token][2]
await execute(
token,
{ from: deployer, log: true },
"mint",
deployer,
BigNumber.from(10).pow(decimals).mul(1000000),
)
}
}
}
export default func
func.tags = ["USDC_FAKE"]

0 comments on commit b3a4aca

Please sign in to comment.