MCPcopy Create free account
hub / github.com/PolymathNetwork/polymath-core / getSignSTMData

Function getSignSTMData

test/helpers/signData.js:5–34  ·  view source on GitHub ↗
(tmAddress, nonce, validFrom, expiry, fromAddress, toAddress, amount, pk)

Source from the content-addressed store, hash-verified

3let BN = Web3.utils.BN;
4
5function getSignSTMData(tmAddress, nonce, validFrom, expiry, fromAddress, toAddress, amount, pk) {
6 let hash = web3.utils.soliditySha3({
7 t: 'address',
8 v: tmAddress
9 }, {
10 t: 'uint256',
11 v: new BN(nonce)
12 }, {
13 t: 'uint256',
14 v: new BN(validFrom)
15 }, {
16 t: 'uint256',
17 v: new BN(expiry)
18 }, {
19 t: 'address',
20 v: fromAddress
21 }, {
22 t: 'address',
23 v: toAddress
24 }, {
25 t: 'uint256',
26 v: new BN(amount)
27 });
28 let signature = (web3.eth.accounts.sign(hash, pk)).signature;
29 let data = web3.eth.abi.encodeParameters(
30 ['address', 'uint256', 'uint256', 'uint256', 'bytes'],
31 [tmAddress, new BN(nonce).toString(), new BN(validFrom).toString(), new BN(expiry).toString(), signature]
32 );
33 return data;
34}
35
36async function getFreezeIssuanceAck(stAddress, from) {
37 const typedData = {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected