ITokenSaleProposal

Interface Description

License: MIT

interface ITokenSaleProposal

The contract for the additional proposal with custom settings. This contract acts as a marketplace to provide DAO pools with the ability to sell their own ERC20 tokens.

Enums info

ParticipationType

enum ParticipationType {
	 DAOVotes,
	 Whitelist,
	 BABT,
	 TokenLock,
	 NftLock
}

The enum that represents the type of requirements to participate in the tier

Parameters:

Structs info

TierMetadata

struct TierMetadata {
	string name;
	string description;
}

Metadata of the tier that is part of the initial tier parameters

Parameters:

VestingSettings

struct VestingSettings {
	uint256 vestingPercentage;
	uint64 vestingDuration;
	uint64 cliffPeriod;
	uint64 unlockStep;
}

Vesting parameters that are part of the initial tier parameters

Parameters:

ParticipationDetails

struct ParticipationDetails {
	ITokenSaleProposal.ParticipationType participationType;
	bytes data;
}

Participation details that are part of the initial tier parameters

Parameters:

TierInitParams

struct TierInitParams {
	ITokenSaleProposal.TierMetadata metadata;
	uint256 totalTokenProvided;
	uint64 saleStartTime;
	uint64 saleEndTime;
	uint64 claimLockDuration;
	address saleTokenAddress;
	address[] purchaseTokenAddresses;
	uint256[] exchangeRates;
	uint256 minAllocationPerUser;
	uint256 maxAllocationPerUser;
	ITokenSaleProposal.VestingSettings vestingSettings;
	ITokenSaleProposal.ParticipationDetails[] participationDetails;
}

Initial tier parameters

Parameters:

VestingTierInfo

struct VestingTierInfo {
	uint64 vestingStartTime;
	uint64 vestingEndTime;
}

Vesting tier-related parameters

Parameters:

TierInfo

struct TierInfo {
	bool isOff;
	uint256 totalSold;
	string uri;
	ITokenSaleProposal.VestingTierInfo vestingTierInfo;
}

Dynamic tier parameters

Parameters:

PurchaseInfo

struct PurchaseInfo {
	EnumerableMap.AddressToUintMap spentAmounts;
	uint256 claimTotalAmount;
	bool isClaimed;
	EnumerableMap.AddressToUintMap lockedTokens;
	EnumerableSet.AddressSet lockedNftAddresses;
	mapping(address => EnumerableSet.UintSet) lockedNfts;
}

Purchase parameters

Parameters:

PurchaseView

struct PurchaseView {
	bool isClaimed;
	bool canClaim;
	uint64 claimUnlockTime;
	uint256 claimTotalAmount;
	uint256 boughtTotalAmount;
	address[] lockedTokenAddresses;
	uint256[] lockedTokenAmounts;
	address[] lockedNftAddresses;
	uint256[][] lockedNftIds;
	address[] purchaseTokenAddresses;
	uint256[] purchaseTokenAmounts;
}

Purchase parameters. This struct is used in view functions as part of a return argument

Parameters:

VestingUserInfo

struct VestingUserInfo {
	uint64 latestVestingWithdraw;
	uint256 vestingTotalAmount;
	uint256 vestingWithdrawnAmount;
}

Vesting user-related parameters

Parameters:

VestingUserView

struct VestingUserView {
	uint64 latestVestingWithdraw;
	uint64 nextUnlockTime;
	uint256 nextUnlockAmount;
	uint256 vestingTotalAmount;
	uint256 vestingWithdrawnAmount;
	uint256 amountToWithdraw;
	uint256 lockedAmount;
}

Vesting user-related parameters. This struct is used in view functions as part of a return argument

Parameters:

ParticipationInfo

struct ParticipationInfo {
	bool isWhitelisted;
	bool isBABTed;
	uint256 requiredDaoVotes;
	EnumerableMap.AddressToUintMap requiredTokenLock;
	EnumerableMap.AddressToUintMap requiredNftLock;
}

Participation parameters. Users should meet all the requirements in order to participate in the tier

Parameters:

UserInfo

struct UserInfo {
	ITokenSaleProposal.PurchaseInfo purchaseInfo;
	ITokenSaleProposal.VestingUserInfo vestingUserInfo;
}

User parameters

Parameters:

UserView

struct UserView {
	bool canParticipate;
	ITokenSaleProposal.PurchaseView purchaseView;
	ITokenSaleProposal.VestingUserView vestingUserView;
}

User parameters. This struct is used in view functions as a return argument

Parameters:

Tier

struct Tier {
	ITokenSaleProposal.TierInitParams tierInitParams;
	ITokenSaleProposal.TierInfo tierInfo;
	ITokenSaleProposal.ParticipationInfo participationInfo;
	mapping(address => uint256) rates;
	mapping(address => ITokenSaleProposal.UserInfo) users;
}

Tier parameters

Parameters:

TierView

struct TierView {
	ITokenSaleProposal.TierInitParams tierInitParams;
	ITokenSaleProposal.TierInfo tierInfo;
}

Tier parameters. This struct is used in view functions as a return argument

Parameters:

WhitelistingRequest

struct WhitelistingRequest {
	uint256 tierId;
	address[] users;
	string uri;
}

Whitelisting request parameters. This struct is used as an input parameter to the whitelist update function

Parameters:

Functions info

latestTierId (0x83d36375)

function latestTierId() external view returns (uint256)

This function is used to get id (index) of the latest tier of the token sale

Return values:

createTiers (0x6a6effda)

function createTiers(
    ITokenSaleProposal.TierInitParams[] calldata tiers
) external

This function is used for tiers creation

Parameters:

addToWhitelist (0xce6c2d91)

function addToWhitelist(
    ITokenSaleProposal.WhitelistingRequest[] calldata requests
) external

This function is used to add users to the whitelist of tier

Parameters:

offTiers (0x20274396)

function offTiers(uint256[] calldata tierIds) external

This function is used to set given tiers inactive

Parameters:

recover (0xc59b695a)

function recover(uint256[] calldata tierIds) external

This function is used to return to the DAO treasury tokens that have not been purchased during sale

Parameters:

claim (0x6ba4c138)

function claim(uint256[] calldata tierIds) external

This function is used to withdraw non-vesting tokens from given tiers

Parameters:

vestingWithdraw (0xe2bdc496)

function vestingWithdraw(uint256[] calldata tierIds) external

This function is used to withdraw vesting tokens from given tiers

Parameters:

buy (0x2afaca20)

function buy(
    uint256 tierId,
    address tokenToBuyWith,
    uint256 amount
) external payable

This function is used to purchase tokens in the given tier

Parameters:

lockParticipationTokens (0x66813a3b)

function lockParticipationTokens(
    uint256 tierId,
    address tokenToLock,
    uint256 amountToLock
) external payable

This function is used to lock the specified amount of tokens to participate in the given tier

Parameters:

lockParticipationNft (0x1ec3f9b7)

function lockParticipationNft(
    uint256 tierId,
    address nftToLock,
    uint256[] calldata nftIdsToLock
) external

This function is used to lock the specified nft to participate in the given tier

Parameters:

unlockParticipationTokens (0x78ee27d7)

function unlockParticipationTokens(
    uint256 tierId,
    address tokenToUnlock,
    uint256 amountToUnlock
) external

This function is used to unlock participation tokens

Parameters:

unlockParticipationNft (0x9471f309)

function unlockParticipationNft(
    uint256 tierId,
    address nftToUnlock,
    uint256[] calldata nftIdsToUnlock
) external

This function is used to unlock the participation nft

Parameters:

getSaleTokenAmount (0xceded63c)

function getSaleTokenAmount(
    address user,
    uint256 tierId,
    address tokenToBuyWith,
    uint256 amount
) external view returns (uint256)

This function is used to get amount of TokenSaleProposal tokens that can be purchased

Parameters:

Return values:

getClaimAmounts (0xd6e93fb2)

function getClaimAmounts(
    address user,
    uint256[] calldata tierIds
) external view returns (uint256[] memory claimAmounts)

This function is used to get information about the amount of non-vesting tokens that user can withdraw (that are unlocked) from given tiers

Parameters:

Return values:

getVestingWithdrawAmounts (0x47d436f7)

function getVestingWithdrawAmounts(
    address user,
    uint256[] calldata tierIds
) external view returns (uint256[] memory vestingWithdrawAmounts)

This function is used to get information about the amount of vesting tokens that user can withdraw (that are unlocked) from given tiers

Parameters:

Return values:

getRecoverAmounts (0x69bc02d5)

function getRecoverAmounts(
    uint256[] calldata tierIds
) external view returns (uint256[] memory recoveringAmounts)

This function is used to get amount of tokens that have not been purchased during sale in given tiers and can be returned to DAO treasury

Parameters:

Return values:

getTierViews (0x884ce0bd)

function getTierViews(
    uint256 offset,
    uint256 limit
) external view returns (ITokenSaleProposal.TierView[] memory tierViews)

This function is used to get a list of tiers

Parameters:

Return values:

getUserViews (0xb27f37a2)

function getUserViews(
    address user,
    uint256[] calldata tierIds
) external view returns (ITokenSaleProposal.UserView[] memory userViews)

This function is used to get user's infos from tiers

Parameters:

Return values: