Contracts

Profile


function createProfile(address owner, string handle, uint32[] avatar) returns (uint256);

function getProfileById(uint256 profileId) returns (Profile);

function getProfileByOwner(address owner) returns (Profile);

function updateHandle(uint256 profileId, string handle);

function createChallenge(uint256 profileId, string name, string description, uint256 depositAmount, uint16 durationInDays) returns (uint256);

function getChallenges(uint256 profileId, uint256 epochId) external view returns (Challenge[] memory);

function submitDailyCompletion(uint256 profileId, uint256 challengeId, uint16 day) external;

Challenge

function createChallenge(
		address owner,
		string name,
		string description,
		address stakeToken,
		uint256 stakeAmount,
		uint256 epochId,
		uint16 durationInDays
) external returns (uint256);

function getChallenge(uint256 tokenId) external view returns (Types.Challenge memory);

function submitDailyCompletion(address owner, uint256 tokenId, uint16 day) external;

ChallengeManager


function getCurrentEpochId() external view returns (uint256);

function getEpochInfo(uint256 epochId) external view returns (Epoch, EpochStatus);

function getEpochStatus(uint256 epochId) external view returns (EpochStatus);

function getEpochChallenges(uint256 epochId) external view returns (uint256[]);

function previewClaimRewards(address owner, uint256 epochId) external view returns (uint256);

function claimRewards(address owner, uint256 epochId) external;

/// Only called by system
function startEpoch(string description, uint256 start, uint16 durationInDays, address depositToken) external returns (uint256);

/// Only called by Challenge
function addChallengeToEpoch(uint256 epochId, uint256 challengeId, address challengeOwner) external;

ERC20Mock

function setBalance(address account, uint256 amount) external

Types

Profile

struct Profile {
	uint256 id;
	address owner;
	string handle;
	// Avatar: [0-background, 1-body, 2-accessory, 3-head, 4-glasses]
	uint32[] avatar;
}

Challenge

struct Challenge {
	uint256 id;
	uint256 epochId;
	uint256 stakeAmount;
	uint256 startTime;
	uint256 endTime;
	address owner;
	address stakeToken;
	uint16 durationInDays;
	string title;
	string description;
	uint256[] dailyCompletionTimestamps;
}

Epoch

struct Epoch {
	uint256 id;
	uint256 startTimestamp;
	uint256 endTimestamp;
	// Number of participants in the epoch
	uint256 participantCount;
	// Total deposits in the epoch
	uint256 totalDeposits;
	// The vault to be used for the epoch
	address vault;
	// The asset to be deposited in the epoch
	address asset;
	uint16 durationInDays;
	string description;
}

EpochStatus

enum EpochStatus {
	// 0 - The epoch has not started yet.
	Pending,
	// 1 - The epoch is active and users can create challenges.
	Active,
	// 2 - The Epoch has ended. Users can no longer create challenges and have a 7-day window to claim rewards.
	Ended,
	// 3 - The epoch is fully closed. No more actions can be performed.
	Closed
}