🐙KUTHULU

The Heart of the Madness!

Table of Contents


Warrant Canary

This is what may be the first of it's kind, a warrant canary for a smart contract

This value should always return "safe" or "test" (on a temp basis)

A warrant canary is a statement that declares that an organization has not taken certain actions or received certain requests for information from government or law enforcement authorities. Many services use warrant canaries to let users know how private their data is.

Some types of law enforcement and intelligence requests come with orders prohibiting organizations from disclosing that they have been received. However, by removing the corresponding warrant canary statement from their website (or wherever it is posted), organizations can indicate that they have received such a request.

Since contract deployment, KUTHULU has the following warrant canaries posted:

  1. KUTHULU has never turned over our encryption or authentication keys to anyone.

  2. KUTHULU has never installed any law enforcement software or code in any smart contract

  3. KUTHULU has never modified the intended destination of DNS responses at the request of law enforcement or another third party.

function canary() public view returns (string);

Public Functions

postMsg

The postMsg function is used to post a new message into KUTHULU. The function takes various parameters including message, _hashtags, taggedAccounts, uri, attribs, and inGroups.

function postMsg(string calldata message, string[] memory _hashtags, address[] calldata taggedAccounts, string calldata uri, uint256[5] calldata attribs, uint256[] memory inGroups) public payable whenNotPaused;

Inputs

Name
Type
Description

message

string

The message you want to post.

_hashtags

array of strings

An array of hashtags to associate with the post. Limit to maxHashtags. (optional)

taggedAccounts

array of addresses

An array of addresses to tag with the post. Limit to maxTaggedAccounts. (optional)

uri

string

A URI to attach to the post. Can be used to attach images / movies / etc. (optional)

attribs

array of uint256

An array of post attributes (comment level / comment to / repost of / group ID)

  • attribs[0] - Comment Level Allowed (0 = No comments Allowed, 1 = Comments Allowed)

  • attribs[1] - Message ID of the post it is a comment to

  • attribs[2] - Message ID of post if it's a repost of another post

  • attribs[3] - Group ID to be posted as

  • attribs[4] - 0 = MATIC tips / >0 = Tips from ERC20 Contract (Contract Address is the last address in taggedAccount array posted)

inGroups

array of uint256

An array of group ID that this message is being posted into. Must be a member of groups. (optional)

Outputs

There is no direct output returned by the function. However, two events are emitted:

  • logMsgPostMsg1

  • logMsgPostMsg2

The events take the message ID, the poster address, the message, an array of hashtags, an array of tagged accounts, and other related parameters as arguments.

Example

The following example demonstrates how to use the postMsg function using ethers.js:

let message = "Hello World!";
let _hashtags = ["openai", "gpt4"];
let taggedAccounts = ["0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B", "0x4E83362442B8d1beC281594Cea3050c8Eb01311C"];
let uri = "https://example.com";
let attribs = [1, 0, 0, 0, 0];
let inGroups = [1, 2];

let contract = new ethers.Contract(contractAddress, abi, provider);
let signer = provider.getSigner();

let postMsgTx = await contract.connect(signer).postMsg(message, _hashtags, taggedAccounts, uri, attribs, inGroups, {value: ethers.utils.parseEther("0.1")});

await postMsgTx.wait();

In this example, a message is posted to the contract with a specified message, hashtags, tagged accounts, a URI, attributes, and group IDs. The function is called with a signer (the account that will post the message) and an attached MATIC amount to be used for tips. The wait function is used to ensure the transaction is mined before proceeding.


Erase Message

This function allows a user to archive a message they posted. Only the original poster can remove thier post.

This clears the data from the blockchain and KUTHULU, but the history of it is ALWAYS there. You can never completely erase anything from the blockchain. Ever.

Input

Parameter
Type
Description

msgID

uint256

The message ID you want to erase

Output

This function does not return any output.

Example with Ethers.js

let msgID = 1;

await contract.eraseMsg(msgID);

Toggle Like

This function allows a user to toggle their like status for a specific message.

Input

Parameter
Type
Description

msgID

uint256

The message ID you want to toggle the like for

Output

This function does not return any output.

Example with Ethers.js

let msgID = 1;

await contract.toggleLike(msgID);

Follow User

This function allows a user to follow another user or group.

Input

Parameter
Type
Description

addressToFollow

address

The user or group address to follow

Output

This function does not return any output.

Example with Ethers.js

let addressToFollow = "0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B";

await contract.followUser(addressToFollow);

Unfollow User

This function allows a user to unfollow another user or group.

Input

Parameter
Type
Description

addressToUnFollow

address

The user or group address to unfollow

Output

This function does not return any output.

Example with Ethers.js

let addressToUnFollow = "0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B";

await contract.unfollowUser(addressToUnFollow);

Get Message IDs by Address

This function retrieves message IDs posted by a specific user or group. The startFrom parameter allows you to paganate through results by passing in the message ID you want to start from. This will returm a maximum of maxMsgReturnCount. If you want to receive all the comments from a user or group, set getUserComments to true. If you want to view a all the posts a user or group has reposted, set getUserReposts to true.

Input

Parameter
Type
Description

usrAddress

address

The user or group address to get message IDs for

startFrom

uint256

The place to start from for paginating

getUserComments

bool

(optional) true = get only the comments of a user

getUserReposts

bool

(optional) true = get only the reposts of a user

Output

This function returns an array of message IDs.

Example with Ethers.js

let usrAddress = "0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B";
let startFrom = 0;
let getUserComments = true;
let getUserReposts = false;

let messageIDs = await contract.getMsgIDsByAddress(usrAddress, startFrom, getUserComments, getUserReposts);

Get Sub IDs by Post

This function retrieves a list of comment IDs or repost IDs of a given message ID.

Input

Parameter
Type
Description

msgID

uint256

The message ID to get comments or reposts for

startFrom

uint256

The place to start from for paginating

isRepost

bool

(optional)

true = get the reposts of the message

false = get the comments of the message

Output

This function returns an array of message IDs.

Example with Ethers.js

let msgID = 1;
let startFrom = 0;
let isRepost = true;

let subIDs = await contract.getSubIDsByPost(msgID, startFrom, isRepost);

Get Message IDs by Hashtag

This function retrieves a list of message IDs that have a certain hashtag.

Input

Parameter
Type
Description

hashtag

string

The hashtag to get messages for

startFrom

uint256

The place to start from for paginating

Output

This function returns an array of message IDs.

Example with Ethers.js

let hashtag = "#cool";
let startFrom = 0;

let messageIDs = await contract.getMsgIDsByHashtag(hashtag, startFrom);

Get Message IDs by Tag

This function retrieves a list of message IDs that have a certain user or group tagged in them.

Input

Parameter
Type
Description

taggedAddress

address

The user or group to get messages for that they are tagged in

startFrom

uint256

The place to start from for paginating

Output

This function returns an array of message IDs.

Example with Ethers.js

let taggedAddress = "0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B";
let startFrom = 0;

let messageIDs = await contract.getMsgIDsByTag(taggedAddress, startFrom);

getMsgsByIDs

This function returns a multi-dimensional array of message data for a given list of message IDs. It uses the MessageData contract to define the structure of the data. The number of IDs that can be passed must be less than maxMsgReturnCount.

Input Parameters

Name
Type
Description

msgIDs

uint256[] calldata

An array of message IDs to get data for.

onlyFollowers

bool

If set to true, it will return only messages of accounts that the provided address follows.

userToCheck

address

This address will be used to filter the response to contain only messages from accounts that this user follows.

Return Parameters

Name
Type
Description

string[][] memory

A multi-dimensional array of message data.

Example Usage with ethers.js

let msgIDs = [1, 2, 3];
let onlyFollowers = true;
let userToCheck = '0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B'; // Sample address

let result = await contract.getMsgsByIDs(msgIDs, onlyFollowers, userToCheck);

getStats

This function returns an array of all stats for the app including message count, comment count, groupPosts, reposts, hashtags, tags, likes, tips, and follows.

Input Parameters

None

Return Parameters

Name
Type
Description

uint256[] memory

An array of stats for the app.

Example Usage with ethers.js

let result = await contract.getStats();

Last updated