Setting token lockup timeframes based on NFT possession
addAccountMinMaxTokenBalance
function that you must call requires that you first determine the bytes32
values of your tag names. You can do this with the cast command built into foundry like so:
bytes32
values are:
Tag Name | Token Allocation | With all Decimals |
---|---|---|
Early Adopter | 1,000 | 1_000_000_000_000_000_000_000 |
Loyal Backer | 500 | 500_000_000_000_000_000_000 |
New Ally | 100 | 100_000_000_000_000_000_000 |
min
argument of the create function instead of three distinct values.Tag Name | Hold Time | Value in hours |
---|---|---|
Early Adopter | 30 days | 720 |
Loyal Backer | 60 days | 1,440 |
New Ally | 90 days | 2,160 |
addAccountMinMaxTokenBalance
function to create this rule, which requires the following arguments:
_accountTypes
(tags), _min
, and _periods
values to be used in the function call. You should already know the _appManagerAddr
and have it defined in your .env
file. The $RULE_ADMIN_KEY
is simply the private key of a wallet that has been granted the rule administrator privilege in your application.
Since this example rule is only about setting a minimum required balance you can pass an array of the max uint256
value for the _max
argument. Finally, the protocol will accept 0
for the _startTime
argument.
The command you need to run, with all of this in mind is outlined below:
blockNumber
, which can then be used to determine the rule ID that was assigned. First, check the output to determine the blockNumber
and then export it as an environment variable like so:
topics
array will contain the hex encoded value of the assigned rule ID.
See an example
burn
, sell
, and transfer
, which are designated with [0,2,4]
.
Before calling the below command, make sure you have the environment variables available in your shell:
0x1234abcd...
in your application that should be assigned the “Early Adopter” tag. Here is the command you would run:
0x1234abcd...
is an incomplete and example address.
You must use the full address of a wallet related to a user of your project.
The 0x4561726c792041646f707465720000...
value after that represents the
bytes32
value of the “Early Adopter” tag, which was determined above.