Skip to content
/ larena Public

On-chain user-generated autonomous art competition.

Notifications You must be signed in to change notification settings

smarsx/larena

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

larena

On-chain user-generated autonomous art competition. Inspired by art-gobblers, basepaint, and inscriptions. Proceeds are paid to top-voted pages.

Live at app.larena.io

Deployments

Network Address
Base 0x000000000004f26431d4bacd23469f04cd99edab
Base-sepolia 0x000000000004f26431d4bacd23469f04cd99edab

Note

This document is not a complete or exhaustive source. At this moment the best source of information is the contracts themselves. Most of the logic is in larena.sol

Epoch

  • a continuous loop of 30-day epochs
  • once an epoch has concluded, votes are tallied, winning pages are crowned, and submitting/voting is opened for the next epoch

Tokens

larena

  • ERC-721 priced on logistic-to-linear VRGDA curve
  • curve switches to linear at epoch ~42, limiting supply to 10/epoch (120/year) for eternity
  • minted with ether
  • continuous lazy $COIN emission (see $COIN)
  • larena's metadata is inherited from top-voted page

larena supply

pages

  • ERC-721 priced on linear VRGDA curve
  • minted with $COIN
  • allows a single submission
  • stores metadata: royalty & sstore2 pointer to onchain data-uri

coin

  • ERC-20 using Gradual Ownership Optimization
  • $COIN is lazily emitted by larena's based on their emission multiple
  • use $COIN to vote on and mint $PAGES

Actions

  • Mint
  • Submit
  • Vote
  • Claim

code shown below is an approximation

Mint

function mint() external payable {
    (uint256 epochID, uint256 epochStart) = currentEpoch();
    uint256 price = _getPrice(epochStart, count);
    if (msg.value < price) revert InsufficientFunds();

    $epochs[epochID].proceeds  = price;

    _mint(msg.sender,   $prevTokenID, epochID,   count);

    // refund ether sent > price
    SafeTransferLib.safeTransferETH(msg.sender, msg.value - price);
}
  • main entry point to larena
  • minting a larena gives you a constant emission of $COIN, which is then used to mint and vote on $PAGES
  • when epoch concludes tokenURI is inherited from top-voted page
  • any funds paid > price are auto-refunded
  • minting is available 24/7, price will modulate supply based on VRGDA parameters

Submit

/// @notice Submit page to an epoch.
/// @param _pageID Page token to use.
/// @param _royalty Royalty in basis points.
/// @param _typeUri Data key in tokenuri output.
/// @param _description Description in tokenuri output.
/// @param _duri DataURI value.
function submit(
    uint256 _pageID,
    uint256 _royalty,
    NFTMeta.TypeURI _typeUri,
    string calldata _description,
    string calldata _duri
) external {
    ...
    address pointer = SSTORE2.write(
        NFTMeta.constructTokenURI(..., _duri, _description)
    );
    $pages.setMetadata(_pageID, _royalty, pointer);
    $submissions[currentEpoch].push(_pageID);
    ...
}
  • an unused $PAGES token is required to make a submission

  • max 100 submissions per epoch

  • top 3 submissions ranked by votes are crowned winners at conclusion of epoch

  • larena tokenURI & royalty are inherited from top-voted submission

  • _duri: any valid data-uri

  • _typeURI (image(0) or animation(1)) - choose data key in tokenURI json.

    • {name: "", description: "", image: ""}
    • vs.
    • {name: "", description: "", animation_url: ""}

Submit Delegate

/// @dev example impl in test/utils/DelegatePage
interface DelegatePage {
    /// @notice return data-uri of resource.
    /// @dev "data:image/svg xml;base64,xxx"
    /// @dev used in Pages.tokenURI
    function tokenUri() external returns (string memory);

    /// @notice return data-uri with metadata and traits.
    /// @dev expected to be data-uri of type data:application/json;base64
    /// @dev required fields: name, description, attributes, image and/or animation_url
    /// @dev required attributes: emissionMultiple
    /// @dev prefer name to be "larena #{_epochID}"
    /// @dev used in larena.tokenURI when Page is the epochs winner (Gold).
    /// @dev for further info on params see src/utils/token/LarenaERC721.sol:LarenaData
    /// @param epochID epoch of the respective larena.
    /// @param emissionMultiple rate at which larena emits Coin.
    /// @param index inner-epoch ID.
    function tokenUri(
        uint256 epochID,
        uint256 emissionMultiple,
        uint256 index
    ) external returns (string memory);
}

/// @notice Submit delegate page to an epoch.
/// @param _pageID Page token to use.
/// @param _royalty Royalty in basis points.
/// @param _pointer Delegate page contract. Must implement DelegatePage interface.
function submitDelegate(uint256 _pageID, uint256 _royalty, address _pointer) {
    ...
    $pages.setMetadata(_pageID, _royalty, _pointer, true);
    $submissions[epochID].push(_pageID);
    ...
}
  • instead of directly submitting a data-uri for a page, submit an address that implements DelegatePage interface.
  • this allows not just onchain data-uri's but generative work as well.
  • not available through UI (in-progress) but contracts are deployed so go crazy

Vote

  • use $COIN to vote on $PAGES
  • voting burns $COIN used
  • in the hours preceeding end of epoch, there is a penalty applied to votes.

Claim

  • once epoch is concluded the owners of top-voted $PAGES can claim their winnings.
  • Gold: 85%
  • Silver: 8%
  • Bronze: 4%
  • Protocol: 3%

Disclaimer

These smart contracts and testing suite are being provided as is. No guarantee, representation or warranty is being made, express or implied, as to the safety or correctness of anything provided herein or through related user interfaces. This repository and related code have not been audited and as such there can be no assurance anything will work as intended, and users may experience delays, failures, errors, omissions, loss of transmitted information or loss of funds. The creators are not liable for any of the foregoing. Users should proceed with caution and use at their own risk.

i love you ❣

About

On-chain user-generated autonomous art competition.

Resources

Stars

Watchers

Forks

Releases

No releases published