Upfront Smart Contract Integration (EVM)
Integrate MersoUpfront for instant, full-payment NFT purchases.
Overview
Upfront integration allows your players to purchase NFTs with full payment in a single transaction. The NFT is transferred directly to the user with no restrictions, wrapping, or installment tracking required.
Integration Requirements
-
β
ERC721/ERC1155 ComplianceYour NFT collection must follow standard ERC721 or ERC1155 interfaces.
-
β
Marketplace IntegrationYour marketplace must be able to call the MersoUpfront contract.
-
β
No wNFT RequiredUpfront purchases transfer the original NFT directlyβno WrappedNFT support needed.
Contract Interface
MersoUpfront Interface
Solidity
interface IMersoUpfront {
// Purchase an NFT with full upfront payment
function buyTokenFrom(
address originalCollection,
uint256 tokenId,
uint256 tokenPrice,
address tokenAddress
) external;
// Check if a collection is allowed
function isAllowedCollection(
address collection
) external view returns (bool);
}
Integration Example
Frontend Integration
JavaScript
import { ethers } from 'ethers';
import MersoUpfront_ABI from './abis/MersoUpfront.json';
const MERSO_UPFRONT_ADDRESS = '0x...'; // Provided during onboarding
async function purchaseUpfront(collection, tokenId, price, paymentToken) {
const provider = new ethers.providers.Web3Provider(window.ethereum);
const signer = provider.getSigner();
// 1. Approve full payment amount
const tokenContract = new ethers.Contract(paymentToken, ERC20_ABI, signer);
await tokenContract.approve(MERSO_UPFRONT_ADDRESS, price);
// 2. Execute upfront purchase
const mersoContract = new ethers.Contract(MERSO_UPFRONT_ADDRESS, MersoUpfront_ABI, signer);
const tx = await mersoContract.buyTokenFrom(
collection,
tokenId,
price,
paymentToken
);
await tx.wait();
console.log('Upfront purchase complete! Original NFT transferred to user.');
}
Upfront vs PNPL Comparison
| Feature | Upfront | PNPL |
|---|---|---|
| Payment Amount | 100% upfront | 50% upfront + 4 weekly |
| NFT Received | Original NFT | WrappedNFT (then original) |
| Transfer Restrictions | None | During payment period |
| Integration Complexity | Lower | Higher (wNFT support) |