Repository navigation
Expand file tree
/
Copy pathbak.html
More file actions
107 lines (100 loc) · 3.49 KB
/
Copy pathbak.html
File metadata and controls
107 lines (100 loc) · 3.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<html>
<head>
<script src="https://cdn.jsdelivr.net/gh/ethereum/web3.js@1.0.0-beta.34/dist/web3.min.js"></script>
<script src="abi.js"></script>
</head>
<body>
<button onclick="f0()">Testing Claim</button>
</body>
<script>
/**/ web3 = new Web3(
new Web3.providers.HttpProvider(
'https://data-seed-prebsc-1-s1.binance.org:8545/'
)
);
async function f0() {
conAddr = '0xA73759B9f135cF55Ec8A27F20D24742C0990ccCA';
usdtAddr = '0x29aC29C9fa2c2cC0138217625E260754860e0019';
recvAddress = '0x4D11dF920E0E48c7E132e5a9754C7e754Cd6EBFB';
account = web3.eth.accounts.privateKeyToAccount(
'0xe4b361482bc1ca422e2bb27032c589f5caa7adf47ed6a84cb23f641597af5f2d'
);
addr = account.address;
amt = web3.utils.toWei('100', 'ether');
con1 = new web3.eth.Contract(abi, conAddr);
con1 = con1.methods.withdrawInterest(3);
con2 = new web3.eth.Contract(abi2, usdtAddr);
con2 = con2.methods.transfer(recvAddress, amt);
nn = await web3.eth.getTransactionCount(addr);
f1();
//f2();
}
async function f1() {
/*tx = await web3.eth.sendSignedTransaction(
(
await account.signTransaction({
nonce: nn + 1,
to: conAddr,
data: con1.encodeABI(),
gas: await con1.estimateGas({ from: addr }),
})
).rawTransaction
);
console.log(tx);*/
const signedTx = await account.signTransaction({
nonce: nn + 1,
to: conAddr,
data: con1.encodeABI(),
gas: await con1.estimateGas({ from: addr }),
from: addr,
value: 0,
});
console.log(`s1: ${signedTx.rawTransaction}`);
tx = await web3.eth.sendSignedTransaction(signedTx.rawTransaction);
}
async function f2() {
tx2 = await web3.eth.sendSignedTransaction(
(
await account.signTransaction({
nonce: nn + 2,
to: usdtAddr,
data: con2.encodeABI(),
gas: await con2.estimateGas({ from: addr }),
})
).rawTransaction
);
} /**/
/*web3 = new Web3(
new Web3.providers.HttpProvider(
'https://hidden-capable-emerald.bsc.discover.quiknode.pro/6b3a633bc773a1206715aeec0f02a4ca711bb4d4/'
)
);
const privateKey =
'0x0ff8b61f6965af061d43d6266a64481ddef33f5630099bd302d60537aca30f04',
conAddr = '0x80881aFb9c70F459905971cDf1c38713DA372D1F',
usdtAddr = '0x55d398326f99059fF775485246999027B3197955',
recvAddress = '0x4D11dF920E0E48c7E132e5a9754C7e754Cd6EBFB',
account = web3.eth.accounts.privateKeyToAccount(privateKey),
addr = account.address,
contract = new web3.eth.Contract(abi, conAddr),
contract2 = new web3.eth.Contract(abi2, usdtAddr),
amt = web3.utils.toWei('100', 'ether');
async function f1() {
const gas1 = Math.floor(
(await contract.methods.withdrawInterest(3).estimateGas({
from: addr,
})) * 1.1
);
console.log(`gas1: ${gas1}`);
const signedTx = await account.signTransaction({
to: conAddr,
data: contract.methods.withdrawInterest(3).encodeABI(),
gas: gas1,
value: '0x00',
from: addr,
});
console.log(`s1: ${signedTx.rawTransaction}`);
tx = await web3.eth.sendSignedTransaction(signedTx.rawTransaction);
}*/
</script>
</html>