Having an issue with a contract when trying to swap after adding liquidity

I recently deployed a contract on APECHAIN using Remix and was wondering if anyone can help identify any issues it might have.

I added liquidity on Camelot Swap.

But before trying to swap I see this message:

At least one token hasn't been priced yet, making it impossible to evaluate the price impact. Please confirm only if you're happy with the current swap rate.

And when I click the Swap button this:

This token's implementation is not compatible with this swap. Try changing the swap provider or contacting the token team for more information.

I've been in touch with their support and one of the people insists that it's the contract while another suggested that the tax in the contract might be an issue on their platform. So I'm trying to rule out any contract/code issue. Any help is appreciated.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

// Import specific versions from OpenZeppelin v4.8.3
import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/v4.8.3/contracts/token/ERC20/ERC20.sol";
import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/v4.8.3/contracts/access/Ownable.sol";

contract CoffeeOnApe is ERC20, Ownable {
    // Fixed tax percentages
    uint256 public constant communityTaxPercent = 1;
    uint256 public constant developmentTaxPercent = 1;
    // Community wallet
    address public communityWallet;
    // Development wallet
    address public developmentWallet;

    event WalletsUpdated(address communityWallet, address developmentWallet);

    // Hardcoded total supply: 21,000,000 tokens.
    uint256 public constant INITIAL_SUPPLY = 21_000_000 * 10 ** 18;

    constructor(
        string memory name_, 
        string memory symbol_, 
        address communityWallet_, 
        address developmentWallet_
    ) ERC20(name_, symbol_) {
        communityWallet = communityWallet_;
        developmentWallet = developmentWallet_;
        _mint(msg.sender, INITIAL_SUPPLY);
    }

    function _transfer(
        address sender,
        address recipient,
        uint256 amount
    ) internal virtual override {
        // Calculate fixed taxes
        uint256 communityTax = (amount * communityTaxPercent) / 100;
        uint256 developmentTax = (amount * developmentTaxPercent) / 100;
        uint256 totalTax = communityTax + developmentTax;
        uint256 amountAfterTax = amount - totalTax;

        // Distribute taxes
        if (communityTax > 0) {
            super._transfer(sender, communityWallet, communityTax);
        }
        if (developmentTax > 0) {
            super._transfer(sender, developmentWallet, developmentTax);
        }
        super._transfer(sender, recipient, amountAfterTax);
    }

    // Owner can update wallet addresses if needed
    function setWallets(address newCommunityWallet, address newDevelopmentWallet) external onlyOwner {
        communityWallet = newCommunityWallet;
        developmentWallet = newDevelopmentWallet;
        emit WalletsUpdated(newCommunityWallet, newDevelopmentWallet);
    }
}

I tested the contract by doing a transfer from Apescan and everything seems to work.

(post deleted by author)

Hello,

It seems like this is an issue related to how Comelot Swap works. There don't appear to be any issues with this contract. Unfortunately, we don't have any insight into the working of Comelot Swap, and you should try to continue working with their support.

3 Likes

Thank you! I will see what I can figure out with them.