Contract

About Decentral ART contract and its parts.

Contract address: 0x7c620D582a6Eae9635E4CA4B9A2b1339F20EE1f2

Parts

We can divide the contract code into several parts of which it is composed:

Token shopping

You can buy tokens using the function: buyTokens() public payable and send the corresponding amount of ethers. Before buy, you can call the function beforeBuyTokens (uint weiAmount) public view returns(bool, string memory, uint), where you insert the parameter weiAmount (how much you will send to ether) and function returns:

  • bool - is error occurred

  • string memory - error description

  • uint - how many tokens you get

After market

If you have tokens, you can put them up for sale. Use function setSellingPrices(uint256[] memory tokenIds, uint[] memory prices) where parametertokenIds is array of token indexes and parameter prices is array of prices in same order. If you set the price to zero, then token is not for sale.

On the other hand, if you want to buy the offered token, You can use the function buyOfferedTokens(uint256[] memory tokenIds). This function is payable and parameter tokenIds is array of token indexes that you want to buy. A fee is added to the price (4,5%).

Before using these functions, we recommend calling the data check functions.

  • beforeSetSellingPrices(uint256[] memory tokenIds, uint[] memory prices) public view returns (bool error, string memory description) - the parameters are the same as for the functionsetSellingPrices and returns if an error occurred and description of an error

  • beforeBuyOfferedTokens(uint256[] memory tokenIds, uint sendingETH) public view returns (bool error, string memory description, uint fee) - The parameter tokenIds is the same as for the function buyOfferedTokens and sendingETH is amount of ETH in WEI.

NFT token ERC721

Each part of the image is an NFT token, this methods are defined, for example here: https://eips.ethereum.org/EIPS/eip-721

The only difference is the charge for transferring the token to another wallet. Token transfer is charged and the size of the fee may vary depending on the tokens sold. This means that functions like transferFrom are payable.

Contract status

The contract has several functions for determining the current status. More information can be obtained from the events.

  • ownerOf(uint256 tokenId) - returns address of token owner by tokenId

  • balanceOf(address owner) - returns the number of tokens owned by the wallet at arddress

  • info() - returns informations about the actual phase (from zero), total mined tokens and the amount of eth in the contract in wei.

  • getTransferFee() - returns the current token transfer fee

Events

ContractCreated (uint TransferFee, Phase[] Phases)

  • TransferFee - initial transfer fee. (not actual)

  • Phases - array of Phase object

    • uint tokensAmount - tokens in phase

    • uint prizesAmount - how many prices are in the stage

    • uint prize - token price in wei

    • uint winAmount - win amount in wei

    • address[] buyers - (for internal use)

    • uint[] winners - (for internal use)

    • uint toGoalWallet (for internal use)

GoalReached (uint16 owningTokens, address winner, uint amount)

  • owningTokens - how many tokens the winner owns

  • winner - winner address

  • amount - win amount in wei

WinHodlers (uint8 index, address[] winners, uint amount)

  • index - index of winning stages (10)

  • winners - list of winners' addresses

  • amount - prize for each winner

TokenPurchased (uint8 oldPhase, uint8 actualPhase, uint256 first, uint256 count, address newOwner)

  • oldPhase - phase before buy token

  • actualPhase - phase after buy token

  • first - first index of buyed token

  • count - number of tokens purchased

  • newOwner - buyer address

VIPFounded (uint[] tokenIds, uint returnAmount, address owner, uint8 phase)

  • tokenIds - array of indexes of VIP tokens

  • returnAmount - total returned ETH in wei

  • owner - who got vip tokens

  • phase - at what phase were they found vip tokens

PricesUpdated (uint256[] tokenIds, uint[] prices, address owner)

  • tokenIds - array of token indexes

  • prices - array of new prices in same order as tokenIds

  • owner - address of tokens owner

TokensSold (uint256[] tokenIds, uint[] tokenPrices, uint fee, address newOwner)

  • tokenIds - array of token indexes

  • tokenPrices - array of token prices in same order as tokenIds

  • fee - total token sales fee

  • newOwner - buyer

Last updated