Files
bls-wallet/contracts/scripts/test/use_wallet.ts
Jacob Caban-Tomski e222b53102 Improve ease and consistancy of monorepo setup
Move contract addresses from env vars to a common JSON network config.
Add io-ts to client to verify network config JSON.
Add setup.ts to bootstrap repo.
Add deploy script for use with deploying all contracts.
Add docker-compose.yml as alternative for postgres setup.
Add main README, update component READMEs.

Co-authored-by: Andrew Morris <voltrevo@gmail.com>
2021-11-29 13:06:43 -07:00

67 lines
1.6 KiB
TypeScript

/* eslint-disable no-process-exit */
import { network, ethers } from "hardhat";
import Fixture from "../../shared/helpers/Fixture";
import getNetworkConfig from "../../shared/helpers/getNetworkConfig";
let config;
// let ethToken: Contract;
let blsAddresses: string[];
async function setup(blsSecretNumbers: number[]): Promise<Fixture> {
config = await getNetworkConfig(network.name);
console.log("config:", config);
console.log("Creating fixture from use wallet...");
const fx = await Fixture.create(blsSecretNumbers.length, blsSecretNumbers);
console.log("Attaching to token:", config.addresses.testToken);
const ERC20 = await ethers.getContractFactory("MockERC20");
ERC20.attach(config.addresses.testToken);
return fx;
}
async function main() {
// setup fixture with bls wallet secret numbers
const fx = await setup([
+process.env.BLS_SECRET_NUM_1,
+process.env.BLS_SECRET_NUM_2,
+process.env.BLS_SECRET_NUM_3,
]);
blsAddresses = (await fx.createBLSWallets()).map((wallet) => wallet.address);
console.log(`BlsWallet contract addresses: ${blsAddresses}`);
// blsWallets = blsAddresses.map((a) => fx.BLSWallet.attach(a));
// blsSignFunction({
// blsSigner: fx.blsSigners[0],
// chainId: fx.chainId,
// nonce: ,
// reward: ,
// contract: ,
// functionName: ,
// params: []
// })
}
// class Wallet {
// constructor(
// signer: BlsSignerInterface,
// contract: Contract
// ) {
// }
// }
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});