Skip to content

IETS

Overview

License: MIT

interface IETS

Data Structures

TaggingRecordRawInput

Raw client input data structure for creating tagging records. This structure represents the basic input data needed from clients to create or modify tagging records in ETS.

struct TaggingRecordRawInput {
    string targetURI;
    string[] tagStrings;
    string recordType;
}

Fields

NameTypeDescription
targetURIstringUnique resource identifier string, eg. "https://google.com\"
tagStringsstring[]Array of hashtag strings, eg. ["#Love", "#Blue"]
recordTypestringArbitrary identifier for type of tagging record

TaggingRecord

The fundamental data structure of ETS that reflects "who tagged what, where and why". Every Tagging record has a unique Id computed from the hashed composite of targetId, recordType, tagger and relayer addresses cast as a uint256.

struct TaggingRecord {
    uint256[] tagIds;
    uint256 targetId;
    string recordType;
    address relayer;
    address tagger;
}

Fields

NameTypeDescription
tagIdsuint256[]Ids of CTAG token(s)
targetIduint256Id of target being tagged
recordTypestringArbitrary identifier for type of tagging record
relayeraddressAddress of Relayer contract that wrote tagging record
taggeraddressAddress of wallet that initiated tagging record via relayer

TaggingAction

Action types available for modifying tags in a tagging record. These actions determine how new tags will be applied to existing tagging records.

enum TaggingAction {
    APPEND,
    REPLACE,
    REMOVE
}

Fields

NameValueDescription
APPEND0Add new tags to an existing tagging record
REPLACE1Overwrite all existing tags with new tag set
REMOVE2Remove specified tags from the tagging record

Events info

AccessControlsSet

event AccessControlsSet(address newAccessControls)

emitted when the ETS Access Controls is set.

Parameters:

NameTypeDescription
newAccessControlsaddresscontract address access controls is set to.

TaggingFeeSet

event TaggingFeeSet(uint256 newTaggingFee)

emitted when ETS tagging fee is set.

Parameters:

NameTypeDescription
newTaggingFeeuint256new tagging fee.

PercentagesSet

event PercentagesSet(uint256 platformPercentage, uint256 relayerPercentage)

emitted when participant distribution percentages are set.

Parameters:

NameTypeDescription
platformPercentageuint256percentage of tagging fee allocated to ETS.
relayerPercentageuint256percentage of tagging fee allocated to relayer of record for CTAG being used in tagging record.

TaggingRecordCreated

event TaggingRecordCreated(uint256 taggingRecordId)

emitted when a new tagging record is recorded within ETS.

Parameters:

NameTypeDescription
taggingRecordIduint256Unique identifier of tagging record.

TaggingRecordUpdated

event TaggingRecordUpdated(uint256 taggingRecordId, IETS.TaggingAction action)

emitted when a tagging record is updated.

Parameters:

NameTypeDescription
taggingRecordIduint256tagging record being updated.
actionenum IETS.TaggingActionType of update applied as TaggingAction enum.

FundsWithdrawn

event FundsWithdrawn(address indexed who, uint256 amount)

emitted when ETS participant draws down funds accrued to their contract or wallet.

Parameters:

NameTypeDescription
whoaddresscontract or wallet address being drawn down.
amountuint256amount being drawn down.

Functions info

createTaggingRecord (0xc38f3037)

function createTaggingRecord(
    uint256[] memory _tagIds,
    uint256 _targetId,
    string calldata _recordType,
    address _tagger
) external payable

Create a new tagging record.

Requirements:

  • Caller must be relayer contract.
  • CTAG(s) and TargetId must exist.

Parameters:

NameTypeDescription
_tagIdsuint256[]Array of CTAG token Ids.
_targetIduint256targetId of the URI being tagged. See ETSTarget.sol
_recordTypestringArbitrary identifier for type of tagging record.
_taggeraddressAddress calling Relayer contract to create tagging record.

getOrCreateTagId (0xa27eee3c)

function getOrCreateTagId(
    string calldata _tag,
    address payable _creator
) external payable returns (uint256 tokenId)

Get or create CTAG token from tag string.

Combo function that accepts a tag string and returns corresponding CTAG token Id if it exists, or if it doesn't exist, creates a new CTAG and then returns corresponding Id.

Only ETS Relayer contracts may call this function.

Parameters:

NameTypeDescription
_tagstringTag string.
_creatoraddress payableAddress credited with creating CTAG.

Return values:

NameTypeDescription
tokenIduint256Id of CTAG token.

createTag (0x54b4d676)

function createTag(
    string calldata _tag,
    address payable _creator
) external payable returns (uint256 tokenId)

Create CTAG token from tag string.

Reverts if tag exists or is invalid.

Only ETS Relayer contracts may call this function.

Parameters:

NameTypeDescription
_tagstringTag string.
_creatoraddress payableAddress credited with creating CTAG.

Return values:

NameTypeDescription
tokenIduint256Id of CTAG token.

applyTagsWithRawInput (0x01f1e2d8)

function applyTagsWithRawInput(
    IETS.TaggingRecordRawInput calldata _rawInput,
    address payable _tagger
) external payable

Apply one or more tags to a targetURI using tagging record raw client input data.

Like it's sister function applyTagsWithCompositeKey, records new ETS Tagging Record or appends tags to an existing record if found to already exist. This function differs in that it creates new ETS target records and CTAG tokens for novel targetURIs and hastag strings respectively. This function can only be called by Relayer contracts.

Parameters:

NameTypeDescription
_rawInputstruct IETS.TaggingRecordRawInputRaw client input data formed as TaggingRecordRawInput struct.
_taggeraddress payableAddress that calls Relayer to tag a targetURI.

applyTagsWithCompositeKey (0x8361d140)

function applyTagsWithCompositeKey(
    uint256[] calldata _tagIds,
    uint256 _targetId,
    string memory _recordType,
    address payable _tagger
) external payable

Apply one or more tags to a targetId using using tagging record composite key.

Records new ETS Tagging Record to the blockchain or appends tags if Tagging Record already exists. CTAGs and targetId are created if they don't exist. Caller must be Relayer contract.

Parameters:

NameTypeDescription
_tagIdsuint256[]Array of CTAG token Ids.
_targetIduint256targetId of the URI being tagged. See ETSTarget.sol
_recordTypestringArbitrary identifier for type of tagging record.
_taggeraddress payableAddress of that calls Relayer to create tagging record.

replaceTagsWithRawInput (0x70a306f7)

function replaceTagsWithRawInput(
    IETS.TaggingRecordRawInput calldata _rawInput,
    address payable _tagger
) external payable

Replace entire tag set in tagging record using raw data for record lookup.

If supplied tag strings don't have CTAGs, new ones are minted.

Parameters:

NameTypeDescription
_rawInputstruct IETS.TaggingRecordRawInputRaw client input data formed as TaggingRecordRawInput struct.
_taggeraddress payableAddress that calls Relayer to tag a targetURI.

replaceTagsWithCompositeKey (0x5bb0b13b)

function replaceTagsWithCompositeKey(
    uint256[] calldata _tagIds,
    uint256 _targetId,
    string memory _recordType,
    address payable _tagger
) external payable

Replace entire tag set in tagging record using composite key for record lookup.

This function overwrites the tags in a tagging record with the supplied tags, only charging for the new tags in the replacement set.

Parameters:

NameTypeDescription
_tagIdsuint256[]Array of CTAG token Ids.
_targetIduint256targetId of the URI being tagged. See ETSTarget.sol
_recordTypestringArbitrary identifier for type of tagging record.
_taggeraddress payableAddress of that calls Relayer to create tagging record.

removeTagsWithRawInput (0x7e2babd0)

function removeTagsWithRawInput(
    IETS.TaggingRecordRawInput calldata _rawInput,
    address _tagger
) external

Remove one or more tags from a tagging record using raw data for record lookup.

Parameters:

NameTypeDescription
_rawInputstruct IETS.TaggingRecordRawInputRaw client input data formed as TaggingRecordRawInput struct.
_taggeraddressAddress that calls Relayer to tag a targetURI.

removeTagsWithCompositeKey (0x3f9fc582)

function removeTagsWithCompositeKey(
    uint256[] calldata _tagIds,
    uint256 _targetId,
    string memory _recordType,
    address payable _tagger
) external

Remove one or more tags from a tagging record using composite key for record lookup.

Parameters:

NameTypeDescription
_tagIdsuint256[]Array of CTAG token Ids.
_targetIduint256targetId of the URI being tagged. See ETSTarget.sol
_recordTypestringArbitrary identifier for type of tagging record.
_taggeraddress payableAddress of that calls Relayer to create tagging record.

appendTags (0x0410ca9f)

function appendTags(
    uint256 _taggingRecordId,
    uint256[] calldata _tagIds
) external payable

Append one or more tags to a tagging record.

Parameters:

NameTypeDescription
_taggingRecordIduint256tagging record being updated.
_tagIdsuint256[]Array of CTAG token Ids.

replaceTags (0x46444c09)

function replaceTags(
    uint256 _taggingRecordId,
    uint256[] calldata _tagIds
) external payable

Replaces tags in tagging record.

This function overwrites the tags in a tagging record with the supplied tags, only charging for the new tags in the replacement set.

Parameters:

NameTypeDescription
_taggingRecordIduint256tagging record being updated.
_tagIdsuint256[]Array of CTAG token Ids.

removeTags (0xa0e0da18)

function removeTags(
    uint256 _taggingRecordId,
    uint256[] calldata _tagIds
) external

Remove one or more tags from a tagging record.

Parameters:

NameTypeDescription
_taggingRecordIduint256tagging record being updated.
_tagIdsuint256[]Array of CTAG token Ids.

drawDown (0xc2062005)

function drawDown(address payable _account) external

Function for withdrawing funds from an accrual account. Can be called by the account owner or on behalf of the account. Does nothing when there is nothing due to the account.

Parameters:

NameTypeDescription
_accountaddress payableAddress of account being drawn down and which will receive the funds.

computeTaggingRecordIdFromRawInput (0x1632a9bc)

function computeTaggingRecordIdFromRawInput(
    IETS.TaggingRecordRawInput calldata _rawInput,
    address _relayer,
    address _tagger
) external view returns (uint256 taggingRecordId)

Compute a taggingRecordId from raw input.

Parameters:

NameTypeDescription
_rawInputstruct IETS.TaggingRecordRawInputRaw client input data formed as TaggingRecordRawInput struct.
_relayeraddressAddress of tagging record Relayer contract.
_taggeraddressAddress interacting with Relayer to tag content ("Tagger").

Return values:

NameTypeDescription
taggingRecordIduint256Unique identifier for a tagging record.

computeTaggingRecordIdFromCompositeKey (0x06d05ed2)

function computeTaggingRecordIdFromCompositeKey(
    uint256 _targetId,
    string memory _recordType,
    address _relayer,
    address _tagger
) external pure returns (uint256 taggingRecordId)

Compute & return a taggingRecordId.

Every TaggingRecord in ETS is mapped to by it's taggingRecordId. This Id is a composite key composed of targetId, recordType, relayer contract address and tagger address hashed and cast as a uint256.

Parameters:

NameTypeDescription
_targetIduint256Id of target being tagged (see ETSTarget.sol).
_recordTypestringArbitrary identifier for type of tagging record.
_relayeraddressAddress of tagging record Relayer contract.
_taggeraddressAddress interacting with Relayer to tag content ("Tagger").

Return values:

NameTypeDescription
taggingRecordIduint256Unique identifier for a tagging record.

computeTaggingFeeFromRawInput (0x249f3eec)

function computeTaggingFeeFromRawInput(
    IETS.TaggingRecordRawInput memory _rawInput,
    address _relayer,
    address _tagger,
    IETS.TaggingAction _action
) external view returns (uint256 fee, uint256 tagCount)

Compute tagging fee for raw input and desired action.

Parameters:

NameTypeDescription
_rawInputstruct IETS.TaggingRecordRawInputRaw client input data formed as TaggingRecordRawInput struct.
_relayeraddressAddress of tagging record Relayer contract.
_taggeraddressAddress interacting with Relayer to tag content ("Tagger").
_actionenum IETS.TaggingActionInteger representing action to be performed according to enum TaggingAction.

Return values:

NameTypeDescription
feeuint256Calculated tagging fee in ETH/Matic
tagCountuint256Number of new tags being added to tagging record.

computeTaggingFeeFromCompositeKey (0x50064ea4)

function computeTaggingFeeFromCompositeKey(
    uint256[] memory _tagIds,
    uint256 _targetId,
    string calldata _recordType,
    address _relayer,
    address _tagger,
    IETS.TaggingAction _action
) external view returns (uint256 fee, uint256 tagCount)

Compute tagging fee for CTAGs, tagging record composite key and desired action.

Parameters:

NameTypeDescription
_tagIdsuint256[]Array of CTAG token Ids.
_relayeraddressAddress of tagging record Relayer contract.
_taggeraddressAddress interacting with Relayer to tag content ("Tagger").
_actionenum IETS.TaggingActionInteger representing action to be performed according to enum TaggingAction.

Return values:

NameTypeDescription
feeuint256Calculated tagging fee in ETH/Matic
tagCountuint256Number of new tags being added to tagging record.

computeTaggingFee (0xa53d30a4)

function computeTaggingFee(
    uint256 _taggingRecordId,
    uint256[] memory _tagIds,
    IETS.TaggingAction _action
) external view returns (uint256 fee, uint256 tagCount)

Compute tagging fee for CTAGs, tagging record id and desired action.

If the global, service wide tagging fee is set (see ETS.taggingFee() & ETS.setTaggingFee()) ETS charges a per tag for all new tags applied to a tagging record. This applies to both new tagging records and modified tagging records.

Computing the tagging fee involves checking to see if a tagging record exists and if so, given the desired action (append or replace) determining the number of new tags being added and multiplying by the ETS per tag fee.

Parameters:

NameTypeDescription
_taggingRecordIduint256Id of tagging record.
_tagIdsuint256[]Array of CTAG token Ids.
_actionenum IETS.TaggingActionInteger representing action to be performed according to enum TaggingAction.

Return values:

NameTypeDescription
feeuint256Calculated tagging fee in ETH/Matic
tagCountuint256Number of new tags being added to tagging record.

getTaggingRecordFromRawInput (0x8633899c)

function getTaggingRecordFromRawInput(
    IETS.TaggingRecordRawInput memory _rawInput,
    address _relayer,
    address _tagger
)
    external
    view
    returns (
        uint256[] memory tagIds,
        uint256 targetId,
        string memory recordType,
        address relayer,
        address tagger
    )

Retrieve a tagging record from it's raw input.

Parameters:

NameTypeDescription
_rawInputstruct IETS.TaggingRecordRawInputRaw client input data formed as TaggingRecordRawInput struct.
_relayeraddressAddress of tagging record Relayer contract.
_taggeraddressAddress interacting with Relayer to tag content ("Tagger").

Return values:

NameTypeDescription
tagIdsuint256[]CTAG token ids.
targetIduint256TargetId that was tagged.
recordTypestringType of tagging record.
relayeraddressAddress of tagging record Relayer contract.
taggeraddressAddress interacting with Relayer to tag content ("Tagger").

getTaggingRecordFromCompositeKey (0xa33def15)

function getTaggingRecordFromCompositeKey(
    uint256 _targetId,
    string memory _recordType,
    address _relayer,
    address _tagger
)
    external
    view
    returns (
        uint256[] memory tagIds,
        uint256 targetId,
        string memory recordType,
        address relayer,
        address tagger
    )

Retrieve a tagging record from composite key parts.

Parameters:

NameTypeDescription
_targetIduint256Id of target being tagged.
_recordTypestringArbitrary identifier for type of tagging record.
_relayeraddressAddress of Relayer contract that wrote tagging record.
_taggeraddressAddress of wallet that initiated tagging record via relayer.

Return values:

NameTypeDescription
tagIdsuint256[]CTAG token ids.
targetIduint256TargetId that was tagged.
recordTypestringType of tagging record.
relayeraddressAddress of tagging record Relayer contract.
taggeraddressAddress interacting with Relayer to tag content ("Tagger").

getTaggingRecordFromId (0x68fd4dee)

function getTaggingRecordFromId(
    uint256 _id
)
    external
    view
    returns (
        uint256[] memory tagIds,
        uint256 targetId,
        string memory recordType,
        address relayer,
        address tagger
    )

Retrieve a tagging record from Id.

Parameters:

NameTypeDescription
_iduint256taggingRecordId.

Return values:

NameTypeDescription
tagIdsuint256[]CTAG token ids.
targetIduint256TargetId that was tagged.
recordTypestringType of tagging record.
relayeraddressAddress of tagging record Relayer contract.
taggeraddressAddress interacting with Relayer to tag content ("Tagger").

taggingRecordExistsByRawInput (0xea552bc1)

function taggingRecordExistsByRawInput(
    IETS.TaggingRecordRawInput memory _rawInput,
    address _relayer,
    address _tagger
) external view returns (bool)

Check that a tagging record exists for given raw input.

Parameters:

NameTypeDescription
_rawInputstruct IETS.TaggingRecordRawInputRaw client input data formed as TaggingRecordRawInput struct.
_relayeraddressAddress of tagging record Relayer contract.
_taggeraddressAddress interacting with Relayer to tag content ("Tagger").

Return values:

NameTypeDescription
[0]boolboolean; true for exists, false for not.

taggingRecordExistsByCompositeKey (0xf79fa988)

function taggingRecordExistsByCompositeKey(
    uint256 _targetId,
    string memory _recordType,
    address _relayer,
    address _tagger
) external view returns (bool)

Check that a tagging record exists by it's componsite key parts.

Parameters:

NameTypeDescription
_targetIduint256Id of target being tagged.
_recordTypestringArbitrary identifier for type of tagging record.
_relayeraddressAddress of Relayer contract that wrote tagging record.
_taggeraddressAddress of wallet that initiated tagging record via relayer.

Return values:

NameTypeDescription
[0]boolboolean; true for exists, false for not.

taggingRecordExists (0x18fc4776)

function taggingRecordExists(
    uint256 _taggingRecordId
) external view returns (bool)

Check that a tagging record exsits by it's Id.

Parameters:

NameTypeDescription
_taggingRecordIduint256taggingRecordId.

Return values:

NameTypeDescription
[0]boolboolean; true for exists, false for not.

totalDue (0x0ad2f0c3)

function totalDue(address _account) external view returns (uint256 _due)

Function to check how much MATIC has been accrued by an address factoring in amount paid out.

Parameters:

NameTypeDescription
_accountaddressAddress of the account being queried.

Return values:

NameTypeDescription
_dueuint256Amount of WEI in MATIC due to account.

taggingFee (0xfe52656f)

function taggingFee() external view returns (uint256)

Function to retrieve the ETS platform tagging fee.

Return values:

NameTypeDescription
[0]uint256tagging fee.