CoreDaoVIP bridges the gap between traditional web developers and blockchain by providing simple APIs that allow:
These facilities make it easier for developers to integrate crypto-based payments into shopping websites, movie booking platforms, and service-based applications without needing deep blockchain knowledge.
The full API provided by CoreDaoVIP is as follows:
// coredaovip.js
// Simple SDK for CoreDaoVip Token (ERC20)
// Import ethers.js (assumes it's already available in project)
const { ethers } = window;
// CoreDaoVip contract
const COREDAOVIP_ADDRESS = "0x3c18c0be00c516d5c08d94a118fb185b99afa601";
const ERC20_ABI = [
"function decimals() view returns (uint8)",
"function balanceOf(address owner) view returns (uint256)",
"function transfer(address to, uint256 value) returns (bool)",
"function approve(address spender, uint256 value) returns (bool)",
"function allowance(address owner, address spender) view returns (uint256)"
];
class CoreDaoVipSDK {
constructor() {
this.provider = null;
this.signer = null;
this.account = null;
}
// 🔹 Connect MetaMask
async connectWallet() {
if (typeof window.ethereum === "undefined") {
throw new Error("MetaMask not installed!");
}
await ethereum.request({ method: "eth_requestAccounts" });
this.provider = new ethers.providers.Web3Provider(window.ethereum);
this.signer = this.provider.getSigner();
this.account = await this.signer.getAddress();
return this.account;
}
// 🔹 Get contract instance
getContract(providerOrSigner = this.provider) {
return new ethers.Contract(COREDAOVIP_ADDRESS, ERC20_ABI, providerOrSigner);
}
// 🔹 Get balance
async getBalance(account = this.account) {
if (!account) throw new Error("Wallet not connected");
const contract = this.getContract(this.provider);
const decimals = await contract.decimals();
const rawBalance = await contract.balanceOf(account);
return ethers.utils.formatUnits(rawBalance, decimals);
}
// 🔹 Check service eligibility
async isEligible(minRequired = 1, account = this.account) {
const balance = await this.getBalance(account);
return parseFloat(balance) >= minRequired;
}
// 🔹 Transfer tokens
async transfer(to, amount) {
if (!this.signer) throw new Error("Wallet not connected");
const contract = this.getContract(this.signer);
const decimals = await contract.decimals();
const value = ethers.utils.parseUnits(amount.toString(), decimals);
const tx = await contract.transfer(to, value);
await tx.wait();
return tx.hash;
}
// 🔹 Approve spender
async approve(spender, amount) {
if (!this.signer) throw new Error("Wallet not connected");
const contract = this.getContract(this.signer);
const decimals = await contract.decimals();
const value = ethers.utils.parseUnits(amount.toString(), decimals);
const tx = await contract.approve(spender, value);
await tx.wait();
return tx.hash;
}
// 🔹 Check allowance
async allowance(owner = this.account, spender) {
const contract = this.getContract(this.provider);
const allowance = await contract.allowance(owner, spender);
return allowance.toString();
}
}
// Export as singleton
window.CoreDaoVipSDK = new CoreDaoVipSDK();
With this API, CoreDaoVIP makes blockchain-based payment integration straightforward and educational, allowing developers to demonstrate and adopt tokenomics use cases with ease.