/**
@member id The tier's ID.
@member contributionFloor The minimum contribution to qualify for this tier.
@member lockedUntil The time up to which this tier cannot be removed or paused.
@member remainingQuantity Remaining number of tokens in this tier. Together with idCeiling this enables for consecutive, increasing token ids to be issued to contributors.
@member initialQuantity The initial `remainingAllowance` value when the tier was set.
@member votingUnits The amount of voting significance to give this tier compared to others.
@member reservedRate The number of minted tokens needed in the tier to allow for minting another reserved token.
@member reservedRateBeneficiary The beneificary of the reserved tokens for this tier.
@member encodedIPFSUri The URI to use for each token within the tier.
@member allowManualMint A flag indicating if the contract's owner can mint from this tier on demand.
*/
struct SNOW721Tier {
uint256 id;
uint256 contributionFloor;
uint256 lockedUntil;
uint256 remainingQuantity;
uint256 initialQuantity;
uint256 votingUnits;
uint256 reservedRate;
address reservedTokenBeneficiary;
bytes32 encodedIPFSUri;
bool allowManualMint;
}
SNOW721PricingParams
Code
link to github
Definition
/**
@member tiers The tiers to set.
@member currency The currency that the tier contribution floors are denoted in.
@member decimals The number of decimals included in the tier contribution floor fixed point numbers.
@member prices A contract that exposes price feeds that can be used to resolved the value of a contributions that are sent in different currencies. Set to the zero address if payments must be made in `currency`.
*/
struct SNOW721PricingParams {
SNOW721TierParams[] tiers;
uint256 currency;
uint256 decimals;
SNOWPrices prices;
}
Event
metadataContentOf
Contract: SnowconeProjects
Interface: ISnowconeProjects
The metadata for each project, which can be used across several domains.
Definition
/**
@notice
The metadata for each project, which can be used across several domains.
_projectId The ID of the project to which the metadata belongs.
_domain The domain within which the metadata applies. Applications can use the domain namespace as they wish.
*/
mapping(uint256 => mapping(uint256 => string)) public override metadataContentOf;
Arguments: _projectId is the ID of the project to which the metadata belongs. _domain is the domain within which the metadata applies. The resulting view function can be accessed externally by anyone. The resulting function overrides a function definition from the ISnowconeProjects interface.
Count
Interface: ISnowconeProjects
The number of projects that have been created using this contract.
The count is incremented with each new project created. The resulting ERC-721 token ID for each project is the newly incremented count value.
Definition
/**
@notice
The number of projects that have been created using this contract.
@dev
The count is incremented with each new project created.
The resulting ERC-721 token ID for each project is the newly incremented count value.
*/
uint256 public override count = 0;
The resulting view function can be accessed externally by anyone. The resulting function overrides a function definition from the ISnowconeProjects interface.
tokenUriResolver
Contract: SnowconeProjects
Interface: ISnowconeProjects
The contract resolving each project ID to its ERC721 URI.
Definition
/**
@notice
The contract resolving each project ID to its ERC721 URI.
*/
ISnowconeTokenUriResolver public override tokenUriResolver;
The resulting view function can be accessed externally by anyone. The resulting function overrides a function definition from the ISnowconeProjects interface.
SNWProjects
Interfaces
Name
Description
ISnowconeProjects
General interface for the methods in this contract that interact with the blockchain's state according to the protocol's rules.
Inheritance
Contract
Description
Constructor
_operatorStore is an ISnowconeOperatorStore contract storing operator assignments.
Events
Name
Data
Properties
Name
Definition
Read
Function
Definition
Write
Function
Definition
Read
tokenURI
Properties
SnowconeOperatable
Includes convenience functionality for checking a message sender's permissions before executing certain transactions.
ERC721Votes
A checkpointable standard definition for non-fungible tokens (NFTs).
Ownable
Includes convenience functionality for specifying an address that owns the contract, with modifiers that only allow access by the owner.
projectId is the token ID of the NFT (ERC-721) that represents the project whose URI was set. metadata is the metadata that was associated with the project upon its creation. It can be found using the metadataContentOf property. caller is the address that issued the transaction within which the event was emitted.
createFor
Create a new project for the specified owner, which mints an NFT (ERC-721) into their wallet.
owner is the address that will be the owner of the project.
metadata is a struct containing metadata content about the project, and domain within which the metadata applies. The function can be accessed externally by anyone. The function overrides a function definition from the ISNWProjects interface. The function returns the token ID of the newly created project.
ndicates if this contract adheres to the specified interface.
See {IERC165-supportsInterface}.
Definition
setTokenUriResolver
Sets the address of the resolver used to retrieve the tokenURI of projects.
Definition
Arguments:
_newResolver is the address of the new resolver.
Through the onlyOwner modifier, this function can only be accessed by the address that owns this contract.
setMetadataOf
Allows a project owner to set the project's metadata content for a particular domain namespace.
Only a project's owner or operator can set its metadata.
Applications can use the domain namespace as they wish.
Definition
Arguments:
SNOW721TierParams
Code
github link
Definition
SNOWDidPayData
SNOWDeployTiered721DelegateData
/**
@member contributionFloor The minimum contribution to qualify for this tier.
@member lockedUntil The time up to which this tier cannot be removed or paused.
@member initialQuantity The initial `remainingAllowance` value when the tier was set.
@member votingUnits The amount of voting significance to give this tier compared to others.
@memver reservedRate The number of minted tokens needed in the tier to allow for minting another reserved token.
@member reservedRateBeneficiary The beneificary of the reserved tokens for this tier.
@member encodedIPFSUri The URI to use for each token within the tier.
@member allowManualMint A flag indicating if the contract's owner can mint from this tier on demand.
@member shouldUseBeneficiaryAsDefault A flag indicating if the `reservedTokenBeneficiary` should be stored as the default beneficiary for all tiers.
*/
struct SNOW721TierParams {
uint256 contributionFloor;
uint256 lockedUntil;
uint256 initialQuantity;
uint256 votingUnits;
uint256 reservedRate;
address reservedTokenBeneficiary;
bytes32 encodedIPFSUri;
bool allowManualMint;
bool shouldUseBeneficiaryAsDefault;
}
projectId is the token ID of the NFT (ERC-721) that was created to represent the project. owner is the address that owns the NFT (ERC-721) token representing the project. metadata is the metadata that was associated with the project upon its creation. It can be found using the metadataContentOf property. caller is the address that issued the transaction within which the event was emitted.
The function overrides a function definition from the ISNWProjects interface. The function doesn't return anything.
Body
Internal references:
tokenUriResolver
Emit a SetTokenUriResolver event with the relevant parameters.
Event references:
SetTokenUriResolver
function setTokenUriResolver(ISNWTokenUriResolver _newResolver) external override onlyOwner { ... }
/// Store the new resolver.
tokenUriResolver = _newResolver;
_projectId is the ID of the project whose metadata is being changed.
_metadata is the struct containing metadata content, and domain within which the metadata applies.
Through the requirePermission modifier, the function is only accessible by the project's owner, or from an operator that has been given the SNWOperations.SET_METADATA permission by the project owner for the provided _projectId.
The function overrides a function definition from the ISNWProjects interface. The function doesn't return anything.
Body
Internal references:
metadataContentOf
Emit a SetMetadataCid event with the relevant parameters.
Arguments: _interfaceId is the ID of the interface to check for adherence to. The view function can be accessed externally by anyone, and internally within this contract. The view function does not alter state on the blockchain. The function overrides a function definition from the IERC165 interface. The function returns a flag indicating if this contract adheres to the specified interface. Body
Return true if the provided interface ID is in the list of interfaces this contract adheres to.
/**@notice Indicates if this contract adheres to the specified interface.
The bug bounty program is a way to incentivize the community to help identify potential vulnerabilities in the contract code. The rewards are categorized based on the severity and potential impact of the identified issue.
Optimization: If you can suggest a way to make the operation more efficient, perhaps by reducing gas costs or improving computational efficiency, you can earn a reward of 0.5 ETH.
Low Severity: If you identify a vulnerability that could lead to an inconvenience for a user of the protocol or for a protocol developer, but doesn't pose a serious risk to the protocol's functionality or users' funds, you can earn a reward of 1 ETH.
High Severity: If you identify a vulnerability that could lead to data corruption or loss of funds, you can earn a reward of 5+ ETH. The exact amount will depend on the severity and potential impact of the issue.
Please note that the rewards are paid out in ETH and the actual USD value may vary based on the current market price of ETH.
Welcome to the Data Structures section of Snowcone documentation. Here you'll find comprehensive details about the different data structures used within Snowcone. We'll go through each of these data structures one by one and discuss how they are used.
Contents
SetTokenUriResolver
Emitted from:
setTokenUriResolver Definition
newResolver is the new URI resolver contract. caller is the address that issued the transaction within which the event was emitted.
SNOWBitmapWord
Code
Githublink
Definition
API
Welcome to the "API" section of Snowcone DAO. This is where you'll find detailed information about our Application Programming Interface (API), which allows developers to interact with our protocol programmatically. Whether you're looking to integrate with Snowcone DAO or build on top of our platform, this section provides the technical details you need. Here's what you can find in each subsection:
Understanding our data structures is key to working with our API effectively. This subsection provides a comprehensive overview of the data structures used in the Snowcone DAO protocol, including their definitions, properties, and usage.
Contracts
Specifications
A contract can become a treasury pay delegate by adhering to ISnowconePayDelegate3_1_1:
When extending pay functionality with a delegate, the protocol will pass a SnowconeDidPayData3_1_1 to the didPay(...) function:
The msg.sender to the delegate will be the payment terminal that facilitated the payment.
We hope this guide helps you understand the various data structures used in the Snowcone protocol. If you have any questions or need further clarification, please reach out to our team.
This subsection dives into the specifics of our smart contracts. It provides detailed specifications for each contract in our protocol, including their functions, parameters, and events. Whether you're looking to deploy a new contract or interact with an existing one, this section has the information you need.
/**
@member The information stored at the index.
@member The index.
*/
struct BitmapWord {
uint256 currentWord;
uint256 currentDepth;
}
In payment terminals based on the SnowconePayoutRedemptionPaymentTerminal3_1_1, such as SnowconeETHPaymentTerminal3_1_1's and SnowconeERC20PaymentTerminal3_1_1's, the pay delegate hook gets called after the project's tokens have been minted and distributed. View the docs.
Ensure to only allow trusted contracts to access the didPay(...) transaction.
Attaching
New delegate contracts should be deployed independently. Once deployed, its address can be returned from a data source hook. See how to build a data source for more.
Examples
interface ISnowconePayDelegate3_1_1 is IERC165 {
function didPay(SnowconeDidPayData3_1_1 calldata data) external payable;
}
import '@openzeppelin/contracts/token/ERC721/ERC721.sol';
import '@snowcone-protocol/contracts-v2/contracts/interfaces/ISnowconeFundingCycleDataSource.sol';
import '@snowcone-protocol/contracts-v2/contracts/interfaces/ISnowconePayDelegate.sol';
import '@snowcone-protocol/contracts-v2/contracts/structs/SnowconeTokenAmount.sol';
contract NFTPayDelegate is ERC721, ISnowconeFundingCycleDataSource, ISnowconePayDelegate {
error INVALID_PAYMENT_EVENT();
ISnowconeDirectory directory;
uint256 projectId;
SnowconeTokenAmount contributionThreshold;
uint256 supply;
// This contract can be used as a funding cycle data source to ensure its didPay function is called once the payment has gone through.
function payParams(SnowconePayParamsData calldata _data)
external
view
override
returns (
uint256 weight,
string memory memo,
ISnowconePayDelegate delegate
)
{
// Forward the received weight and memo, and use this contract as a pay delegate.
return (_data.weight, _data.memo, ISnowconePayDelegate(address(this)));
}
// This is unused but needs to be included to fulfill ISnowconeFundingCycleDataSource.
function redeemParams(SnowconeRedeemParamsData calldata _data)
external
pure
override
returns (
uint256 reclaimAmount,
string memory memo,
ISnowconeRedemptionDelegate delegate
)
{
// Return the default values.
return (_data.reclaimAmount.value, _data.memo, ISnowconeRedemptionDelegate(address(0)));
}
constructor(ISnowconeDirectory _directory, uint256 _projectId, SnowconeTokenAmount _contributionThreshold, string calldata _name, string calldata _symbol) ERC721(_name, _symbol) {
directory = _directory;
projectId = _projectId;
},
// Called once the payment has gone through if the project's current funding cycle is using a data source that returns this delegate.
function didPay(SnowconeDidPayData calldata _data) external override {
// Make sure the caller is a terminal of the project, and the call is being made on behalf of an interaction with the correct project.
if (
!directory.isTerminalOf(projectId, ISnowconePaymentTerminal(msg.sender)) ||
_data.projectId != projectId
) revert INVALID_PAYMENT_EVENT();
// Make the contribution is being made in the expected token.
if (_data.amount.token != contributionThreshold.token) return;
// Make sure the values use the same number of decimals.
if (_data.amount.decimals < contributionThreshold.decimals) return;
// Make sure the threshold is met.
if (_data.amount.value < contributionThreshold.value) return;
uint256 _tokenId = ++supply;
_mint(_data.beneficiary, _tokenId);
}
}