Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
131 lines (95 sloc) 3.31 KB

An Index is a list of locators sorted by score. View the code on GitHub.

Structs

Entry

struct Entry {
  bytes32 locator;
  uint256 score;
  address prev;
  address next;
}

Functions

constructor

Create a new Index contract.

constructor() public

setLocator

Set an Locator on the Index.

function setLocator(
  address identifier,
  uint256 score,
  bytes32 locator
) external onlyOwner
Param Type Description
identifier address On-chain address identifying the owner of a locator.
score uint256 Score for the locator being set.
locator bytes32 Locator.

A successful setLocator emits a SetLocator event.

event SetLocator(
  address indexed identifier,
  uint256 score,
  bytes32 indexed locator
);

Revert Reason Scenario
ENTRY_ALREADY_EXISTS This address already has an Entry on the Index.

unsetLocator

Unset a Locator from the Index.

function unsetLocator(
  address identifier
) external onlyOwner returns (bool) {

A successful unsetLocator emits an UnsetLocator event.

event UnsetLocator(
  address event identifier
);
Param Type Description
identifier address On-chain address identifying the owner of a locator.

Revert Reason Scenario
ENTRY_DOES_NOT_EXIST This address does not have an Entry on the Index.

getScore

Gets the score for a given identifier.

function getScore(
  address identifier
) external view returns (uint256)
Param Type Description
identifier address On-chain address identifying the owner of a locator.

getLocator

Gets the locator as bytes32 for a given identifier.

function getLocator(
  address identifier
) external view returns (bytes32)
Param Type Description
identifier address On-chain address identifying the owner of a locator.

getLocators

Get a Range of Locators.

function getLocators(
   address cursor,
   uint256 limit
) external view returns (bytes32[] memory locators, uint256[] memory scores, address nextCursor) {
Param Type Description
cursor address Cursor to start with.
limit uint256 Maximum number of locators to return.
You can’t perform that action at this time.