arbsep faucet

This commit is contained in:
Tim
2024-07-17 16:34:41 -04:00
parent e434ecaa3d
commit 2dbaedf46e

View File

@@ -1,11 +1,26 @@
import {ethers} from "ethers";
import {getProvider} from "./blockchain.js";
import {chainInfo} from "./chain.js";
import {mockERC20Contract} from "./contract.js";
import {mockERC20Contract, newContract} from "./contract.js";
import {metadata} from "../web/src/version.js";
export async function gib( chainId, owner, vault, tokenAmounts ) {
if (!owner || !vault) return
if (chainId === 421614) {
// Arbitrum-Sepolia
// Find the USDC mock coin and print 10k
for (const t of metadata[421614].t) {
if (t.s === 'USDC' && t.x.mock) {
// print 10,000 USDC
const provider = getProvider(chainId);
const usdc = await newContract(t.a, 'MockERC20', provider)
await usdc.mint(vault, 10_000_000000)
console.log(`minted 10,000 USDC to ${vault}`)
}
}
return
}
if( (chainId === 31337 || chainId === 1337) ) {
const provider = getProvider(chainId);
let faucet = new ethers.Wallet(
@@ -33,6 +48,7 @@ export async function gib( chainId, owner, vault, tokenAmounts ) {
}
}
if (chainId === 31337) {
const info = chainInfo[chainId]
if (info.mockCoins) {
const [coinAddr, usdAddr] = info.mockCoins
@@ -42,5 +58,7 @@ export async function gib( chainId, owner, vault, tokenAmounts ) {
await (await mockERC20Contract(usdAddr, signer)).mint(vault, 10_000n * 10n ** 6n)
}
}
return
}
}