Artfi

CertiKFiles named in the report

CertiK reviewed Artfi Token (Artfi) on 5 Mar 2024: 81 findings, 5 critical; 65 marked fixed, 7 acknowledged, 9 open.

2 open critical findings
Open the reportOpen Artfi Token’s security record

Report hosted on skynet.certik.com.

Trustblock does not review code.

Findings81

Statuses are the security firm’s own, from its report.

SeverityOpenAcknowledgedFixed
Critical203
High046
Medium0319
Low7037
CriticalMissing Decimals Conversion And Rounding Issue HaOpen

The `Artfi-Convert` contract intends to convert the price of the `ArtfiIPassVoucher` token into different cryptocurrencies (ETH, USDC, USDT) based on current exchange rates. However, due to the nature of integer arithmetic in Solidity and the handling of decimal places, the contract is currently not functioning as intended. Suppose the `ArtfiIPassVoucherV2(passAddress).getPassPrice()` is 10 USD (10 * 10^8). ### Rounding Issue Due to Integer Division ```solidity function convertPriceToEth(address passAddress) public view returns(uint256){ uint256 price = ArtfiIPassVoucherV2(passAddress).getPassPrice(); int rate = getDataFeedLatestAnswerEth(); uint256 priceEth = price / uint256(rate); return priceEth; } ``` In functions like `convertPriceToEth`, the computed price becomes zero when dividing a smaller price (10 * 10^8) by a larger rate (2,101 * 10^8), leading to incorrect and misleading output. ### Incorrect Handling of Decimal Places The convert function fails to adequately handle the conversion between different decimal scales, particularly the standard 18 decimals for ETH and 6 decmials for USDT and USDC. ```solidity function convertPriceToUsdc(address passAddress) public view returns(uint256){ uint256 price = ArtfiIPassVoucherV2(passAddress).getPassPrice(); // 10 * 10 ** 8 int rate = getDataFeedLatestAnswerUsdc(); // 1 * 10 ** 8 uint256 priceUsdc = price / uint256(rate); return priceUsdc; } ``` For example, if the `rate` is `1 * 10 ** 8`, the `priceUsdc` will be 10, instead of `10 ** 10^6`.

CriticalNFT Transfer Centralization RiskOpen

The issue in the `transferNft()` function of both the `ArtfiCollectionV2` and `ArtfiPassVoucherV2` contracts is that it allows any account granted with the `ARTFI_MARKETPLACE_ROLE` or `ARTFI_ADMIN_ROLE` to transfer NFTs from one address to another, even without the approval of the NFT owner. The `isArtfiMarketplace` or `isArtfiAdminOrMarketplace` modifier are used to restrict access to specific roles, allowing only accounts with the privileged roles to execute the function. However, the function itself does not check if the `from_` address has approved the transfer or if the `msg.sender` (the account executing the function) has the necessary approval to transfer the NFT. This lack of approval check means that anyone with the privileged roles can transfer NFTs owned by other users without their explicit approval. This can lead to unauthorized transfers of NFTs, potentially resulting in loss, theft, or unauthorized movement of valuable assets. ```solidity function transferNft( address from_, address to_, uint256 tokenId_ ) public isArtfiAdminOrMarketplace { _transfer(from_, to_, tokenId_); emit eTokenTransfer(from_, to_, tokenId_); } ``` ```solidity modifier isArtfiAdminOrMarketplace() { if ( !hasRole(ARTFI_MARKETPLACE_ROLE, msg.sender) && !hasRole(DEFAULT_ADMIN_ROLE, msg.sender) && !hasRole(ARTFI_ADMIN_ROLE, msg.sender) ) revert GeneralError("AF:106"); _; } ``` ```solidity function transferNft( address from_, address to_, uint256 tokenId_ ) external isArtfiMarketplace { _transfer(from_, to_, tokenId_); if (_nftInfos[tokenId_].isFirstSale) _nftInfos[tokenId_].isFirstSale = false; } ``` ```solidity modifier isArtfiMarketplace() { if (!hasRole(ARTFI_MARKETPLACE_ROLE, msg.sender)) revert GeneralError("AF:106"); _; } ```

LowIncompatibility With Deflationary TokensOpen

When transferring deflationary ERC20 tokens, it's important to consider that the amount received may not be equal to the amount sent due to transaction fees. For example, if a user sends 100 deflationary tokens with a 10% transaction fee, only 90 tokens may actually arrive at the contract. Failing to account for these fees can lead to issues where a user can withdraw more tokens from the contract than they have actually deposited. In the `ArtfiMarketplaceV2` contract, users can buy collections or vouchers by first transferring tokens to the marketplace contract. The marketplace then transfers the same amount of tokens to the sellers. If the `tokenAddress` is deflationary token, the function call would potentially revert. ```solidity=474 bool successTransfer = IERC20Upgradeable(tokenDetails.tokenAddress) .transferFrom(msg.sender, address(this), totalPayment); ``` ```solidity=478 _payout( Payout( tokenDetails.tokenAddress, recipientAddresses, paymentAmount ) ); ```

LowIncomplete Implementation of Staking ContractOpen

To ensure clarity, we would like to confirm the process of staking with the team: 1. The admin creates a Collection NFT (Collection A) using the `CollectionFactory` contract. 2. The admin mints some Collection A's NFT tokens. Each NFT token's `creators` field will contain the address of the `staking` contract. 3. Some NFT tokens will be sold or bought in the market, and some NFT tokens will be staked in the `staking` contract. 4. Royalty fees received by the `staking` contracts can be shared among the staked NFT tokens. Please let us know if this process is correct and if there are any additional steps that the user needs to follow. We have several questions about the current design: - We would like to know how the `royalties_` value is determined for the `staking` contract during this process. - The staking contract currently only supports ETH as the reward token, but it does not have the functionality to handle royalties fees of other ERC20 tokens like USDT or USDC. - The `receive` function contains the following condition: `if (msg.sender != address(_artfiIManager)) _distributeFunds();`. However, we noticed that there is no logic in the `ArtfiManager` contract to transfer ether. This clarification will provide us a better understanding of the reward distribution system and its interaction with the staking mechanism, enhancing our overall understanding of the project's design.

LowPotential Denial of Service (DoS) Risk in `_payouOpen

The issue in the `_payout()` function of the `ArtfiMarketplaceV2` and `ArtfiFixedPriceV2` contract is that it transfers native coin (Ether) to the `refundAddresses` using the `call` method with a specified gas limit of 2300 or `transfer` which has fixed 2300 gas. This creates a potential security risk, as it allows for a Denial of Service (DoS) attack. ```solidity=676 payable(payoutData_.refundAddresses[i]).transfer( payoutData_.refundAmounts[i] ); ``` ```solidity=538 payable(payoutData_.refundAddresses[i]).transfer( payoutData_.refundAmounts[i] ); ``` In the above code snippet, the problem arises if one of the addresses in the `refundAddresses` is a contract address with a `fallback()` or `receive()` function that requires more gas than the specified 2300 gas limit. In such a situation, the `call` will fail, causing the `_payout()` function to revert. As a result, the `_payout()` function becomes unusable for anyone trying to invoke it.

LowPotential Issue in `mintPassBatch()` FunctionOpen

For the design of the Pass Voucher token, we still have several points that need to be confirmed with team. 1. In the latest commit [edad32e048fa8da0f568c471bdad1a5bde6bcf0d](https://github.com/artfilabs/contracts-v2/tree/edad32e048fa8da0f568c471bdad1a5bde6bcf0d) to the `ArtfiMarketplaceV2` smart contract, the `mintPassBatch()` function enables users to obtain pass vouchers. This function, marked as public, can be executed by anyone, provided they pay the necessary tokens. A noteworthy detail is that the function permits the same address to be set for both the `mintData_.seller`—who is to receive the token payment—and the `buyer`—who gets the Pass Voucher NFT. This raises the potential for an exploit where a user could essentially retrieve the pass vouchers for no more than the cost of the transaction fees, as the tokens expended are returned to them. 2. The `mintPassBatch` function enables the whitelisted buyer to determine the price and seller of the Pass Voucher. However, it appears that this pricing information will not be stored in the Pass Voucher token's Data. Therefore, regardless of the price set by the buyer, all newly minted Pass Vouchers will be identical except for the token ID under the current design. 3. Additionally, the mechanism for claiming NFTs via pass vouchers appears disabled in the recent updates, leaving users with unused pass voucher tokens.

LowPotential Out-of-Gas ExceptionOpen

When a loop allows an arbitrary number of iterations or accesses state variables in its body, the function may run out of gas and revert the transaction. ```solidity=486 for (uint256 i = 0; i < nftData.creators.length; i++) { ``` Function `ArtfiManagerV2._payoutArtfiCollection` contains a loop and its loop condition depends on external calls: `ArtfiICollectionV2(contractAddress_).getNftInfo`. --- ```solidity=139 for (uint256 i = 0; i < stakers.length; i++) { ``` Function `ArtfiStakingV2.addRoyalties` contains a loop and its loop condition depends on parameters: `stakers`. --- ```solidity=141 for (uint256 j = 0; j < stakerStakes; j++) { ``` Function `ArtfiStakingV2.addRoyalties` contains a loop and its loop condition depends on state variables: `_stakes`. --- ```solidity=188 for (uint256 i = 0; i < _stakes[staker].length; i++) { ``` Function `ArtfiStakingV2.getStakedNFTs` contains a loop and its loop condition depends on state variables: `_stakes`. --- ```solidity=219 for (uint256 i = 0; i < _stakes[collectionAddress].length; i++) { ``` Function `ArtfiStakingV2.getIndex` contains a loop and its loop condition depends on state variables: `_stakes`.

LowPotential Vulnerabilities in Function `_is20()`Open

In the `ArtfiManagerV2` contract, the function `_is20()` aims to verify if a given address is an ERC20 token by calling the `name()`, `symbol()`, and `decimals()` functions, which are part of the ERC20 token standard. ```solidity=606 function _is20(address tokenContract) internal returns (bool) { bytes memory payload1 = abi.encodeWithSignature("name()"); (bool success1, ) = tokenContract.call(payload1); bytes memory payload2 = abi.encodeWithSignature("symbol()"); (bool success2, ) = tokenContract.call(payload2); bytes memory payload3 = abi.encodeWithSignature("decimals()"); (bool success3, ) = tokenContract.call(payload3); return success1 && success2 && success3; } ``` However, the implementation presents vulnerabilities: 1. **Use of `.call()` for `view` Functions**: The function uses `.call()` to interact with the potential ERC20 contract. The `.call()` method is a low-level interface for sending a message to a contract, and it's generally used for functions that could alter the state. Since `name()`, `symbol()`, and `decimals()` are `view` functions that do not modify the contract state, `.staticcall()` is the appropriate method to use. This would ensure that no state changes can occur as a result of the calls. 2. **Lack of Return Value Checks**: The `_is20()` function does not check the return values of the `name()`, `symbol()`, or `decimals()` calls. Even if a contract does not implement these functions, if it has a `fallback()` function designed to handle unknown function calls, the calls to `name()`, `symbol()`, and `decimals()` would still succeed, erroneously indicating that the contract is an ERC20 token. This can lead to false positives, allowing non-ERC20 contracts to pass the ERC20 validation.

LowUsing External Account as Proxy Admin Instead ofOpen

In the `ArtfiProxy` proxy contract, it uses an external account (EOA) as the admin of the proxy contract instead of a contract. In the OpenZeppelin's transparent proxy pattern, the admin of the proxy is expected to be a contract, which allows for better control and management of the proxy functionality. Using an EOA as the admin of the proxy can potentially lead to security vulnerabilities and limitations in terms of upgradeability and administrative actions.

Contracts in scope

No deployed address is recorded for this audit.

The report names a repository or files. Open the report to see its scope.

Repository and files the report names (12)

  • contracts/Artfi-PassVoucher.sol
  • contracts/Artfi-StakingFactory.sol
  • contracts/Artfi-CollectionProxy.sol
  • contracts/Artfi-CollectionFactory.sol
  • contracts/Artfi-AdminProxy.sol
  • contracts/Artfi-Marketplace.sol
  • contracts/Artfi-PassVoucherFactory.sol
  • contracts/Artfi-PriceConvert.sol
  • contracts/Artfi-Collection.sol
  • contracts/Artfi-Staking.sol
  • contracts/Artfi-FixedPrice.sol
  • contracts/Artfi-Manager.sol

Part of Artfi Token’s security record

Artfi Token
Audits1 audit by 1 firmLast audit Mar 2024, by CertiK.
Critical findings2 open critical findingsReported in “Artfi” by CertiK, Mar 2024. Not marked fixed in that report.
Open Artfi Token’s security record

Security firm

CertiK

1,045 projects reviewed · 1,376 reports · latest May 2025

See CertiK’s audits

Something wrong on this page? A missing report, a wrong date, a finding that was fixed since. Tell us and we check it against its source.

Tell us