SampleContractHook
A sample Solidity Smart Contract to show how to code your own Contract Hook. Contract Hooks are called every time a user with it setup gets tagged in a message.
Last updated
A sample Solidity Smart Contract to show how to code your own Contract Hook. Contract Hooks are called every time a user with it setup gets tagged in a message.
Last updated
The pause
function is used to halt all the activities of the contract. Only an admin can pause the contract.
Input
This function does not require any input parameters.
Output
This function does not return any output.
Example Usage
The unpause
function is used to resume the activities of the contract after being paused by an admin.
Input
This function does not require any input parameters.
Output
This function does not return any output.
Example Usage
The updateAdmin
function allows an admin to add or remove other admins.
Input
admin
address
Address of the admin to be updated
status
bool
True to add, false to remove
Output
This function does not return any output.
Example Usage
The updateKUTHULUContracts
function allows an admin to set the KUTHULU contracts.
Input
contractAddress
address
Address of the contract to be updated
status
bool
True to add, false to remove
Output
This function does not return any output.
Example Usage
The updateContracts
function allows an admin to update the addresses of KUTHULU, KUtils and DOOM contracts.
Input
_kuthulu
address
New address of the KUTHULU contract
_kutils
address
New address of the KUtils contract
_doom
address
New address of the DOOM contract
Output
This function does not return any output.
Example Usage
The mintDoom
function allows an admin to mint a certain quantity of DOOM tokens to the contract for it to spend on posting back to KUTHULU.
Input
quantity
uint256
Amount of DOOM tokens to be minted
Output
This function does not return any output.
Example Usage
The KuthuluHook
function serves as a means of receiving a message and logging its details for testing purposes. It's set to skip al functionality and just return true
if a msgID of 0 is sent. This is done when the user sets up the Contract Hook on KUTHULU and KUTHULU calls this contract to verify that it's setup correctly. Once a non-zero message ID is received when a regular post is sent via the KUTHULU Contract Hook, the function posts a test message acknowledging the receipt of the original message by calling the postMessage
private function.
newMsg
MsgData
(memory)
An object holding all relevant details of a message.
The MsgData
object contains the following fields:
msgID
uint
ID of the message.
postedBy
address[2]
Addresses of the message poster and the proxy.
message
string
Content of the message.
paid
bool
Indicator if the message is paid.
hashtags
string[]
Array of hashtags included in the message.
taggedAccounts
address[]
Array of accounts tagged in the message.
asGroup
uint
ID of the group where the message was posted.
inGroups
uint[]
Array of group IDs where the message was posted.
uri
string
URI of the message.
commentLevel
uint
The comment level of the message.
isCommentOf
uint
Message ID that the current message is a comment of.
isRepostOf
uint
Message ID that the current message is a repost of.
msgStats
MsgStats
(object)
An object holding statistics about the message.
The MsgStats
object within the MsgData
object has the following fields:
postByContract
bool
Indicator if the message was posted by a contract.
time
uint
Timestamp when the message was posted.
block
uint
Block number when the message was posted.
tipsReceived
uint
Total tips received to split among all tagged accounts.
tipERC20Amount
uint
Total amount of ERC20 token tips received.
bool
Returns a boolean value (True) if the function execution is successful.
Should it return false, then no one will be able to tag the user or group with the contract hook in place as the transaction will always revert.
The getKuthuluMsgCount
function fetches the total number of messages posted in KUTHULU. It can be used to track the activities on the KUTHULU platform.
Input
This function does not require any input parameters.
Output
output
uint256
Total number of messages in the KUTHULU app
Example Usage
This function is triggered internally by the KuthuluHook
function which is called by KUTHULU when the contract hook is invoked.
The postTestMessage
function posts a test message back to KUTHULU, and is used for testing purposes within the contract.
The toggleLike
function allows a user to toggle this contracts like status for a particular message on the KUTHULU platform.