Whitelist a smart contract

Integration Guide for whitelisting a smart contract

To whitelist a contract you require a verified merchant account. If you have doubts about it, please contact us.

Step-by-Step Guide to whitelist a smart contract:

Step 1: Navigate to Contracts Section

Within your application settings, locate and select the Contracts section.

Step 2: Initiate Contract whitelist

Click on "Add contract"

Step 3: Completing the Contract data

Form Completion Guidelines:

  1. Contract Address: Ensure to provide a valid contract address.
  2. Chain: Specify the chain in which the contract address was deployed. We support the following chains (ARBITRUM, AVALANCHE, BASE, BINANCE, EOSEVM, ETHEREUM, FANTOM, GNOSIS, KLAYTN, OPTIMISM, POLYGON, DFK)
  3. Function declaration: We need the function declaration to be exactly the one in the contract so we can correctly interact with it.
  4. Name of the function: We need the function name to be exactly the one in the contract so we can correctly interact with it.
  5. Alias: This must be a unique alias so you can easily identify it and use it when creating the charge.

If your contract is verified, you can get this information from the scan (polygonscan, etherscan, etc). For example, if you want to our system to mint an nft that in your contract is call "mint", like this example, you can add:

  • ContractAddress: 0x518DDC52452DC47864c045E64842C2b873FDB350
  • Chain: Polygon
  • Function declaration: 'function mint() external payable'
  • Function name : 'mint'
  • Alias: 'Mint'

Step 4: Create a charge

Once you have whitelisted the contract you can use it to create a charge.

This transaction will follow the normal flow but the last step of it will be an interaction with the contract that you have selected. For more information about it you can check our API reference related to create charge.

Example:

The function that will be used in this example is 'mint' which doesn't receive a 'functionsParams' property but does receive some native balance.

{
    "chargeData": {
        "chain": "POLYGON", // this chain must be the same as the contract whitelisted
        "symbol": "MATIC",
        "tokenAddress": "0x0000000000000000000000000000000000000000", // MATIC - POLYGON
        "items": [
            {
                "amount": 2.5,
                "image": "https://images.esellerpro.com/3698/I/25/0008557_wenaas-chef-t-shirt-crew-neck-cotton-white.jpeg",
                "name": "SomeGame 1 year game-pass",
                "quantity": 1
            }
        ]
    },
    "callSmartContractProps": {
        "alias": "mint", // this has to be a whitelisted alias 
      	"nativeValue": "2500000000000000000" // this must be with all the decimals. In this example you are sending 2.5 MATIC, only needed when sending native.
    }
}

The nativeValue requires the total value of all amount inside of items to be in its native crypto format.

In the example we are sending 2.5 MATIC for SomeGame 1 year game-pass, and we need to send nativeValue into the request, so we need to convert 2.5 MATIC to its native crypto format.

If the value is 1 USDC, you don't have to add the property nativeValue. The amount added in nativeValue will be sent to the contract. This is a very common way to mint a NFT.

Below is a table of common decimals.

CryptoCurrencyDecimals
USDC for most EVM-compatible Chains6
MATIC/ETH/AVAX and other EVM-compatible Tokens18
BUSD for USDC in Binance18

To convert, we need to do:

nativeValue = 2.5 MATIC * 10^18 = 2500000000000000000

That's how we got the nativeValue = 2500000000000000000.

The same logic applies for functionParams. You need to check how the function is implemented, what parameters the function accepts. And the values need to be in, usually, its native crypto format as well. But that will depend on the implementation.

Example 1: If the contract has a function call buyNFT that receives the amount of USDC with decimals you need to send, for example, for 1 USDC, as a function params => 1000000
Example 2: If the contract has a function call buyNFT that receives the amount of USDC without the decimals because inside that function the amount is transformed from 1 to 1000000, you need to send as functionParams 1.

In the following case the contract we call a function call deposit that receives only one param that is the amount of USDC with all the decimals (because that is the implementation in this particular contract). So functionParams receives just one param that is 1000000 .

Please see example below:

{  
    "chargeData": {  
        "chain": "POLYGON", // this chain must be the same as the contract whitelisted  
        "symbol": "USDC",  
        "tokenAddress": "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359", //USDC POLYGON  
        "items": [  
            {  
                "amount": 1,  
                "image": "https://images.esellerpro.com/3698/I/25/0008557_wenaas-chef-t-shirt-crew-neck-cotton-white.jpeg",  
                "name": "SomeGame 1 year game-pass",  
                "quantity": 1  
            }  
        ]  
    },  
    "callSmartContractProps": {  
        "alias": "vault", // this has to be a whitelisted alias  
      	functionParams: ["1000000"],
        nativeValue: "0" // =====> as we are not sending native, we set it as 0.
    }  
}

Because we're sending 1 USDC, based on the Common Decimal Table above, USDC typically has 6 decimals. That's how we got the 1000000. As it is not needed nativeValue it is set to 0.