Skip to content

Commit 5608f1a

Browse files
authored
Merge pull request #1618 from keep-network/update-create-grant-params
Update create grant params
2 parents a1d3409 + fdb1f8c commit 5608f1a

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

solidity/dashboard/src/services/token-grants.service.js

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,24 +47,21 @@ const createGrant = async (web3Context, data, onTransationHashCallback) => {
4747

4848
/**
4949
* Extra data contains the following values:
50-
* grantee (20 bytes) Address of the grantee.
51-
* cliff (32 bytes) Duration in seconds of the cliff after which tokens will begin to unlock.
52-
* start (32 bytes) Timestamp at which unlocking will start.
53-
* revocable (1 byte) Whether the token grant is revocable or not (1 or 0).
54-
* stakingPolicyAddress (20 bytes) The staking policy as an address
50+
* from Address of the grant manager.
51+
* grantee Address of the grantee.
52+
* cliff Duration in seconds of the cliff after which tokens will begin to unlock.
53+
* start Timestamp at which unlocking will start.
54+
* revocable Whether the token grant is revocable or not (1 or 0).
55+
* stakingPolicyAddress The staking policy as an address
5556
*/
5657
const stakingPolicyAddress = revocable ?
5758
getGuaranteedMinimumStakingPolicyContractAddress() :
5859
getPermissiveStakingPolicyContractAddress()
5960

60-
const extraData = Buffer.concat([
61-
Buffer.from(grantee.substr(2), 'hex'),
62-
web3Utils.toBN(duration).toBuffer('be', 32),
63-
web3Utils.toBN(start).toBuffer('be', 32),
64-
web3Utils.toBN(cliff).toBuffer('be', 32),
65-
Buffer.from(revocable ? '01' : '00', 'hex'),
66-
Buffer.from(stakingPolicyAddress.substr(2), 'hex'),
67-
])
61+
const extraData = web3Context.eth.abi.encodeParameters(
62+
['address', 'address', 'uint256', 'uint256', 'uint256', 'bool', 'address'],
63+
[yourAddress, grantee, duration, start, cliff, revocable, stakingPolicyAddress]
64+
);
6865

6966
const formattedAmount = web3Utils.toBN(amount).mul(web3Utils.toBN(10).pow(web3Utils.toBN(18))).toString()
7067

0 commit comments

Comments
 (0)