Skip to content

Commit 5ffa88c

Browse files
[hebaov2] deploy test on bsv (#2340)
1 parent fc6213a commit 5ffa88c

File tree

3 files changed

+84
-1
lines changed

3 files changed

+84
-1
lines changed

packages/hebao_v2/hardhat.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ export default {
5353
accounts: loadTestAccounts().map(item => item.privateKey)
5454
},
5555

56+
bsctestnet: {
57+
url: "https://data-seed-prebsc-1-s1.binance.org:8545",
58+
chainId: 97,
59+
gasPrice: 20000000000,
60+
accounts: loadTestAccounts().map(item => item.privateKey)
61+
},
62+
5663
arbitrum: {
5764
chainId: 212984383488152,
5865
url: "https://kovan4.arbitrum.io/rpc",
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
const hre = require("hardhat");
2+
const ethers = hre.ethers;
3+
import {
4+
newWalletImpl,
5+
newWalletFactoryContract
6+
} from "../test/commons";
7+
import { signCreateWallet } from "../test/helper/signatureUtils";
8+
import BN = require("bn.js");
9+
10+
async function newWallet() {
11+
const smartWalletAddress = "0xE708Cb725D6F2aDeEab2258262Aa9129D2A28312";
12+
const walletFactoryAddress = "0x5Dd70df24364DC05D46C8F40611BFDd107927263";
13+
14+
const ownerAccount = (await ethers.getSigners())[0];
15+
const ownerAddr = await ownerAccount.getAddress();
16+
const fakeGuardian1 = "0x" + "12".repeat(20);
17+
const salt = 1;
18+
const signature = signCreateWallet(
19+
walletFactoryAddress,
20+
ownerAddr,
21+
[fakeGuardian1],
22+
new BN(0),
23+
ethers.constants.AddressZero,
24+
ethers.constants.AddressZero,
25+
ethers.constants.AddressZero,
26+
new BN(0),
27+
salt
28+
);
29+
const walletConfig: any = {
30+
owner: ownerAddr,
31+
guardians: [fakeGuardian1],
32+
quota: 0,
33+
inheritor: ethers.constants.AddressZero,
34+
feeRecipient: ethers.constants.AddressZero,
35+
feeToken: ethers.constants.AddressZero,
36+
feeAmount: 0,
37+
signature: Buffer.from(signature.txSignature.slice(2), "hex")
38+
};
39+
40+
const walletFactory = await (await ethers.getContractFactory(
41+
"WalletFactory"
42+
)).attach(walletFactoryAddress);
43+
44+
const walletAddrComputed = await walletFactory.computeWalletAddress(
45+
ownerAddr,
46+
salt
47+
);
48+
console.log("walletAddrcomputed:", walletAddrComputed);
49+
50+
const tx = await walletFactory.createWallet(walletConfig, salt, { gasLimit:10000000 });
51+
console.log("tx:", tx);
52+
const receipt = await tx.wait();
53+
console.log("receipt:", receipt);
54+
}
55+
56+
async function newWalletFactory() {
57+
const walletFactory = await newWalletFactoryContract();
58+
console.log("walletFactory:", walletFactory.address);
59+
}
60+
61+
// run with: npx hardhat run --network arbitrum scripts/deploy-arbitrum.ts
62+
async function main() {
63+
// await newWalletFactory();
64+
65+
// success tx:
66+
// https://testnet.bscscan.com/tx/0x9ab2028456c3e432cfb4ee63997b07716b757d9c215e4e96651674b74e473f7c
67+
await newWallet();
68+
}
69+
70+
main()
71+
.then(() => process.exit(0))
72+
.catch(error => {
73+
console.error(error);
74+
process.exit(1);
75+
});

packages/hebao_v2/test/helper/Constants.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ export class Constants {
33
static readonly zeroAddress = "0x" + "00".repeat(20);
44
static readonly emptyBytes32 = "0x" + "00".repeat(32);
55
// static readonly chainId = 31337; // hardhat & ganache default chainId
6-
static readonly chainId = 212984383488152; // arbitrum testnet chainId
6+
// static readonly chainId = 212984383488152; // arbitrum testnet chainId
7+
static readonly chainId = 97; // binance bsc testnet chainId
78
}

0 commit comments

Comments
 (0)