Skip to content

Account Metadata

Every Ethereum account (address) automatically is supported by EFP. Users may follow any other address and any address can mint an EFP List NFT.

It useful to store EFP-related metadata that is specific to an account, such as a user’s primary EFP list. This is key-value metadata for an account is called Account Metadata.

Any Ethereum account may store key-value data in the EFPAccountMetadata contract specific to their account.

Data is stored by string key and bytes value, for each Ethereum account.

This allows for the storage of account-specific EFP configuration or preference data.

Global Keys

Global Keys must be made up of lowercase letters, numbers and the hyphen (-) character.

There is only one global key for account metadata currently defined.

KeyDescription
primary-listThe 32-byte token ID of the primary EFP List NFT for an account

primary-list

The primary-list key is used to specify the Primary List for an account. (Note: For a list to be considered a Primary List, the User role for the list must match the account that specified the list as its Primary List in Account Metadata. Only Primary Lists are counted in Followers.)

The Primary List is represented as a 32-byte token id.

Byte(s)DescriptionValue
0-31Token ID (32 bytes)0x0000000000000000000000000000000000000000000000000000000000000001

Code

with example code shown below:

// set the primary EFP List for the caller's address
efpAccountMetadata.setValue("primary-list", abi.encodePacked(tokenId));

By reading the primary-list key for a given address, a client can determine the primary EFP List for that address.

address addr = <address>
uint primaryEfpListTokenId = abi.decode(efpAccountMetadata.getValue(addr, "primary-list"), (uint));
// validate: primary EFP List must exist
require(primaryEfpListTokenId < efpListRegistry.totalSupply());
// validate the user for this EFP List is the caller
address user = abi.decode(efpListMetadata.getValue(primaryEfpListTokenId, "user"), (address));
require(user == addr);

Custom Keys

The format for custom keys are undefined at this time but will be defined in the future.