Artiste / creators Token

Picardy Artiste Token smart contract is an ERC20 token contract that represents an artist or a creation that can be tokenized and traded. The contract is owned by a specific address and has a fixed maximum supply. The contract also has a reference to a factory contract and has a cost associated with minting new tokens.

The contract has several functions that allow users to interact with it:

mint() this function allows the owner of the contract to mint new tokens and transfer them to a specified address. It takes in the number of tokens to be minted and the address to which the tokens should be transferred as arguments. It checks that the number of tokens being minted is less than the maximum supply, that the owner has sufficient balance to pay for the tokens, and that the value passed in the message call is equal to the cost of the tokens. If these conditions are met, the function calls the _mint function to transfer the tokens to the specified address.

withdraw() this function allows the owner of the contract to withdraw their balance, minus a percentage taken as a fee for royalties. The function retrieves the percentage of royalties and the address to which the royalties should be paid from the factory contract using the getRoyaltyDetails() function. It then calculates the fee to be taken as a percentage of the owner's balance and calls the call function on the royalty address, passing the fee as value. It then calls the call function on the owner's address, passing the balance minus the fee as value. The function requires that both calls are successful in order to proceed.

Last updated