🎟️RaffleTix

Raffle Tickets are awarded to users for participating in the KUTHULU ecosystem. They are used to grant access to NFT mints and other rewards. They can also be purchased with MATIC.

RaffleTix is a smart contract used to manage raffle tickets which are minted as NFTs (ERC-1155). It also includes administrative functionalities, like managing raffle ticket claim by users, observing whale activities, and handling multi-signature locks for transfers.

Table of Contents


Public Functions

mintTix

The mintTix function allows a user to mint themselves a new Raffle Tix. It only allows for up to 10 Raffle Tix to be minted at a time, to prevent spamming.

Parameters

Name
Type
Description

quantity

uint256

The amount of Raffle Tix a user wishes to mint.

const ethers = require('ethers');
const provider = new ethers.providers.JsonRpcProvider('<rpc-url>');
const signer = new ethers.Wallet('<private-key>', provider);
const contract = new ethers.Contract('<contract-address>', abi, signer);

let quantity = 5;

async function mintRaffleTix() {
    let tx = await contract.mintTix(quantity, { value: ethers.utils.parseEther((costToMint * quantity).toString()) });
    console.log(tx.hash);
}
mintRaffleTix();

claimTix

The claimTix function allows a user to claim their awarded Raffle Tix. This function can be called only if a user has Raffle Tix to claim.

async function claimRaffleTix() {
    let tx = await contract.claimTix();
    console.log(tx.hash);
}
claimRaffleTix();

checkTix

The checkTix function checks the amount of Raffle Tix a user can claim.

Parameters

Name
Type
Description

user

address

Address to check the number of claimable Raffle Tix.

let userAddress = '0x1234...';

async function checkRaffleTix() {
    let claimableTix = await contract.checkTix(userAddress);
    console.log('Claimable Raffle Tix: ', claimableTix.toString());
}
checkRaffleTix();

getWhaleSizes

The getWhaleSizes function returns a list of token amounts owned by addresses.

async function getWhaleSize() {
    let whaleSizes = await contract.getWhaleSizes();
    console.log('Whale Sizes: ', whaleSizes);
}
getWhaleSize();

getWhales

The getWhales function returns a list of addresses owning a certain amount of tokens.

Parameters

Name
Type
Description

level

uint256

The amount of tokens owned by a single address.

let tokenLevel = 10;

async function getWhaleAddresses() {
    let whaleAddresses = await contract.getWhales(tokenLevel);
    console.log('Whale Addresses: ', whaleAddresses);
}
getWhaleAddresses();

tokenURI

The tokenURI function returns the token metadata URI for a given token ID.

Parameters

Name
Type
Description

_tokenID

uint256

The unique token ID.

let tokenID = 1;

async function getTokenURI() {
    let uri = await contract.tokenURI(tokenID);
    console.log('Token URI: ', uri);
}
getTokenURI();

Multi-Sig Functions

addMultiSigLock

The addMultiSigLock function is used to add a MultiSig address for locking token transfers.

Parameters

Name
Type
Description

tokenID

uint256

The token ID to lock with the multi-sig address.

multiSigAddress

address

The wallet address to be used to lock the token with.

let tokenID = 1;
let multiSigAddress = '0x1234...';

async function addLock() {
    let tx = await contract.addMultiSigLock(tokenID, multiSigAddress);
    console.log(tx.hash);
}
addLock();

activateMultiSigLock

The activateMultiSigLock function activates the MultiSig lock added to a token.

Parameters

Name
Type
Description

tokenID

uint256

The token ID to lock with the multi-sig address.

let tokenID = 1;

async function activateLock() {
    let tx = await contract.activateMultiSigLock(tokenID);
    console.log(tx.hash);
}
activateLock();

removeMultiSigLock

The removeMultiSigLock function removes a MultiSig lock from a token.

Parameters

Name
Type
Description

tokenID

uint256

The token ID to unlock with the multi-sig address.

let tokenID = 1;

async function removeLock() {
    let tx = await contract.removeMultiSigLock(tokenID);
    console.log(tx.hash);
}
removeLock();

getMultiSigAddress

The getMultiSigAddress function returns the MultiSig address associated with a token.

Parameters

Name
Type
Description

tokenID

uint256

The token ID to return the multi-sig address for.

let tokenID = 1;

async function getMultiSigAddr() {
    let address = await contract.getMultiSigAddress(tokenID);
    console.log('MultiSig Address: ', address);
}
getMultiSigAddr();

isMultiSigLocked

The isMultiSigLocked function checks if a token is locked.

Parameters

Name
Type
Description

tokenID

uint256

The token ID to check for the multi-sig lock.

let tokenID = 1;

async function checkLock() {
    let lockStatus = await contract.isMultiSigLocked(tokenID);
    console.log('Is Locked: ', lockStatus[0]);
    console.log('Is Address Added: ', lockStatus[1]);
}
checkLock();

Last updated