scratch, add alt way to recover signer key

mnemonic + path
This commit is contained in:
Oskar Thoren 2021-02-05 13:14:39 +08:00
parent d6b20efce6
commit 7fcc4e99ec
No known key found for this signature in database
GPG Key ID: BDB55C8C0EF29911
1 changed files with 14 additions and 5 deletions

View File

@ -1,21 +1,30 @@
// Scratch code, to be pasted into a REPL
// [user@work-dev minimal-swap-poc-hardhat]$ npx hardhat run scripts/setup-swap.js --network localhost
//
//
[user@work-dev minimal-swap-poc-hardhat]$ npx hardhat run scripts/setup-swap.js --network localhost
ERC20: 0x5FbDB2315678afecb367f032d93F642f64180aa3
SimpleSwapFactory: 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512
Alice address: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
Bob address: 0x70997970C51812dc3A010C7d01b50e0d17dc79C8
AliceSwapAddress: 0xCafac3dD18aC6c6e92c921884f9E4176737C052c
BobSwapAddress: 0x9f1ac54BEF0DD2f6f3462EA0fa94fC62300d3a8e
Alice ERC20 balance: 10000
Bob ERC20 balance: 10000
var erc20address = "0x5FbDB2315678afecb367f032d93F642f64180aa3";
// Seems to persist, first two default accounts
var aliceAddress = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266";
var aliceSwapAddress = "0xCafac3dD18aC6c6e92c921884f9E4176737C052c";
var bobAddress = "0x70997970C51812dc3A010C7d01b50e0d17dc79C8";
// XXX These change
var erc20address = "0x5FbDB2315678afecb367f032d93F642f64180aa3";
var aliceSwapAddress = "0xCafac3dD18aC6c6e92c921884f9E4176737C052c";
var mnemonic = "test test test test test test test test test test test junk";
var path0 = "m/44'/60'/0'/0/0";
var path1 = "m/44'/60'/0'/0/1";
ethers.Wallet.fromMnemonic(mnemonic, path0);
ethers.Wallet.fromMnemonic(mnemonic, path1);
//SimpleSwapFactory: 0x8A791620dd6260079BF849Dc5567aDC3F2FdC318
//Bob address: 0x70997970C51812dc3A010C7d01b50e0d17dc79C8
//BobSwapAddress: 0xe082b26cEf079a095147F35c9647eC97c2401B83