contracts.html•15 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Smart Contract Interaction - Neo N3 MCP Examples</title>
<meta name="description" content="Learn to interact with famous Neo N3 smart contracts: NeoFS, NeoBurger, Flamingo, NeoCompound, and more.">
<meta name="keywords" content="neo, blockchain, mcp, smart contracts, examples">
<!-- Favicon -->
<link rel="icon" type="image/svg+xml" href="/assets/favicon.svg">
<!-- Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
<!-- Modern Theme -->
<link rel="stylesheet" href="/assets/css/modern-theme.css">
<style>
.breadcrumb {
color: var(--text-secondary);
margin-bottom: var(--spacing-lg);
}
.breadcrumb a {
color: var(--primary);
text-decoration: none;
}
.example-section {
margin-bottom: var(--spacing-3xl);
}
.example-section h2 {
font-family: var(--font-heading);
font-size: 1.75rem;
font-weight: 600;
margin-bottom: var(--spacing-lg);
color: var(--text-primary);
}
.next-steps {
margin-top: var(--spacing-3xl);
text-align: center;
}
.step-cards {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: var(--spacing-lg);
margin-top: var(--spacing-xl);
}
.step-card {
background: var(--bg-card);
padding: var(--spacing-xl);
border-radius: var(--radius-lg);
border: 1px solid var(--border-primary);
text-decoration: none;
color: inherit;
transition: var(--transition);
}
.step-card:hover {
transform: translateY(-4px);
box-shadow: var(--shadow-lg);
border-color: var(--primary);
}
.step-card h3 {
font-family: var(--font-heading);
font-size: 1.2rem;
font-weight: 600;
margin-bottom: var(--spacing-sm);
color: var(--text-primary);
}
.step-card p {
color: var(--text-secondary);
margin: 0;
}
</style>
</head>
<body>
<!-- Navigation -->
<nav class="nav" id="nav">
<div class="nav-container">
<a href="/" class="nav-logo">Neo N3 MCP</a>
<div class="nav-menu">
<a href="/" class="nav-link">Home</a>
<a href="/#features" class="nav-link">Features</a>
<a href="/docs" class="nav-link">Docs</a>
<a href="/examples" class="nav-link active">Examples</a>
<a href="https://github.com/r3e-network/neo-n3-mcp" class="btn btn-primary" target="_blank">Get Started</a>
</div>
</div>
</nav>
<div class="page-container">
<div class="breadcrumb">
<a href="/examples">Examples</a> > Smart Contract Interaction
</div>
<header style="text-align: center; margin-bottom: 3rem;">
<h1 class="section-title">Smart Contract Interaction</h1>
<p class="section-subtitle">
Interact with famous Neo N3 smart contracts and build DeFi applications
</p>
</header>
<div class="example-section">
<h2>🔥 Flamingo DeFi Protocol</h2>
<p>Interact with Flamingo DEX for token swaps and liquidity provision:</p>
<div class="code-window">
<div class="code-header">
<span class="code-lang">Flamingo Token Swap</span>
</div>
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<div class="code-content">
<pre>// Get Flamingo exchange rates
const rates = await tools.flamingo_get_exchange_rate({
fromToken: "NEO",
toToken: "GAS",
amount: "10"
});
// Execute token swap on Flamingo
const swapResult = await tools.flamingo_swap_tokens({
fromAddress: "NZNos2WqTbu5oCgyfss9kUJgBXJqhuYAaj",
fromToken: "NEO",
toToken: "GAS",
amount: "10",
minReceived: "45.5", // Minimum amount to receive
password: "wallet_password"
});
console.log("Swap executed:", swapResult);
// Output:
// {
// "txid": "0x1234567890abcdef...",
// "fromAmount": "10.00000000",
// "toAmount": "46.25340000",
// "fee": "0.00234567",
// "success": true
// }</pre>
</div>
</div>
</div>
<div class="example-section">
<h2>📁 NeoFS Decentralized Storage</h2>
<p>Store and retrieve files using NeoFS distributed storage network:</p>
<div class="code-window">
<div class="code-header">
<span class="code-lang">NeoFS File Operations</span>
</div>
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<div class="code-content">
<pre>// Upload file to NeoFS
const uploadResult = await tools.neofs_upload_file({
address: "NZNos2WqTbu5oCgyfss9kUJgBXJqhuYAaj",
filename: "document.pdf",
content: "base64_encoded_file_content",
password: "wallet_password"
});
// Get file information
const fileInfo = await tools.neofs_get_file_info({
fileId: uploadResult.fileId
});
// Download file from NeoFS
const downloadResult = await tools.neofs_download_file({
fileId: uploadResult.fileId,
address: "NZNos2WqTbu5oCgyfss9kUJgBXJqhuYAaj"
});
console.log("File operations:", {
upload: uploadResult,
info: fileInfo,
download: downloadResult
});
// Output:
// {
// "upload": {
// "fileId": "0xabc123def456...",
// "size": 1024,
// "storageCost": "0.5"
// },
// "info": {
// "filename": "document.pdf",
// "size": 1024,
// "owner": "NZNos2WqTbu5oCgyfss9kUJgBXJqhuYAaj",
// "created": "2024-01-15T10:30:00Z"
// }
// }</pre>
</div>
</div>
</div>
<div class="example-section">
<h2>🍔 NeoBurger Gaming Integration</h2>
<p>Interact with NeoBurger gaming ecosystem and NFT marketplace:</p>
<div class="code-window">
<div class="code-header">
<span class="code-lang">NeoBurger NFT Operations</span>
</div>
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<div class="code-content">
<pre>// Get user's NeoBurger NFTs
const userNFTs = await tools.neoburger_get_user_nfts({
address: "NZNos2WqTbu5oCgyfss9kUJgBXJqhuYAaj"
});
// Get NeoBurger marketplace listings
const marketplaceItems = await tools.neoburger_get_marketplace({
category: "burgers",
minPrice: "1",
maxPrice: "100"
});
// Purchase NFT from marketplace
const purchaseResult = await tools.neoburger_purchase_nft({
buyerAddress: "NZNos2WqTbu5oCgyfss9kUJgBXJqhuYAaj",
nftId: "burger_001",
price: "25.5",
password: "wallet_password"
});
// Stake NeoBurger for rewards
const stakeResult = await tools.neoburger_stake({
address: "NZNos2WqTbu5oCgyfss9kUJgBXJqhuYAaj",
nftId: "burger_001",
duration: 30, // days
password: "wallet_password"
});
console.log("NeoBurger operations:", {
nfts: userNFTs,
marketplace: marketplaceItems,
purchase: purchaseResult,
stake: stakeResult
});</pre>
</div>
</div>
</div>
<div class="example-section">
<h2>💰 NeoCompound Lending Protocol</h2>
<p>Lend and borrow assets using NeoCompound DeFi protocol:</p>
<div class="code-window">
<div class="code-header">
<span class="code-lang">Lending and Borrowing</span>
</div>
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<div class="code-content">
<pre>// Get current lending rates
const rates = await tools.neocompound_get_rates();
// Supply assets to earn interest
const supplyResult = await tools.neocompound_supply({
address: "NZNos2WqTbu5oCgyfss9kUJgBXJqhuYAaj",
asset: "GAS",
amount: "100",
password: "wallet_password"
});
// Get user's supply balance and earned interest
const supplyBalance = await tools.neocompound_get_supply_balance({
address: "NZNos2WqTbu5oCgyfss9kUJgBXJqhuYAaj",
asset: "GAS"
});
// Borrow against collateral
const borrowResult = await tools.neocompound_borrow({
address: "NZNos2WqTbu5oCgyfss9kUJgBXJqhuYAaj",
asset: "NEO",
amount: "5",
collateralAsset: "GAS",
password: "wallet_password"
});
// Repay borrowed amount
const repayResult = await tools.neocompound_repay({
address: "NZNos2WqTbu5oCgyfss9kUJgBXJqhuYAaj",
asset: "NEO",
amount: "5.25", // Principal + interest
password: "wallet_password"
});
console.log("Lending protocol:", {
rates: rates,
supply: supplyBalance,
borrow: borrowResult,
repay: repayResult
});</pre>
</div>
</div>
</div>
<div class="example-section">
<h2>📊 GrandShare Investment Platform</h2>
<p>Participate in investment pools and receive dividends:</p>
<div class="code-window">
<div class="code-header">
<span class="code-lang">Investment Pool Operations</span>
</div>
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<div class="code-content">
<pre>// Get available investment pools
const pools = await tools.grandshare_get_pools();
// Join an investment pool
const joinResult = await tools.grandshare_join_pool({
address: "NZNos2WqTbu5oCgyfss9kUJgBXJqhuYAaj",
poolId: "tech_fund_001",
amount: "50",
password: "wallet_password"
});
// Get user's investment positions
const positions = await tools.grandshare_get_positions({
address: "NZNos2WqTbu5oCgyfss9kUJgBXJqhuYAaj"
});
// Claim dividends
const claimResult = await tools.grandshare_claim_dividends({
address: "NZNos2WqTbu5oCgyfss9kUJgBXJqhuYAaj",
poolId: "tech_fund_001",
password: "wallet_password"
});
// Exit investment pool
const exitResult = await tools.grandshare_exit_pool({
address: "NZNos2WqTbu5oCgyfss9kUJgBXJqhuYAaj",
poolId: "tech_fund_001",
shares: "25", // Partial exit
password: "wallet_password"
});
console.log("Investment operations:", {
pools: pools,
positions: positions,
claim: claimResult,
exit: exitResult
});</pre>
</div>
</div>
</div>
<div class="next-steps">
<h2>Next Steps</h2>
<div class="step-cards">
<a href="/examples/wallet" class="step-card">
<h3>Wallet Operations</h3>
<p>Learn wallet management and asset transfers</p>
</a>
<a href="/examples/explorer" class="step-card">
<h3>Blockchain Explorer</h3>
<p>Query blockchain data and transaction details</p>
</a>
<a href="/docs/api" class="step-card">
<h3>Full API Reference</h3>
<p>Complete documentation of all available tools</p>
</a>
</div>
</div>
</div>
<!-- Footer -->
<footer class="footer">
<div class="footer-container">
<div class="footer-grid">
<div>
<div class="footer-brand">Neo N3 MCP</div>
<p class="footer-description">
The most advanced Neo N3 blockchain development platform.
Build powerful dApps with enterprise-grade tools and security.
</p>
</div>
<div>
<h4 class="footer-title">Product</h4>
<div class="footer-links">
<a href="/docs" class="footer-link">Documentation</a>
<a href="/examples" class="footer-link">Examples</a>
<a href="/changelog" class="footer-link">Changelog</a>
</div>
</div>
<div>
<h4 class="footer-title">Resources</h4>
<div class="footer-links">
<a href="https://docs.neo.org/" class="footer-link" target="_blank">Neo N3 Docs</a>
<a href="https://modelcontextprotocol.io/" class="footer-link" target="_blank">MCP Protocol</a>
<a href="https://www.npmjs.com/package/@r3e/neo-n3-mcp" class="footer-link" target="_blank">NPM Package</a>
</div>
</div>
<div>
<h4 class="footer-title">Community</h4>
<div class="footer-links">
<a href="https://github.com/r3e-network/neo-n3-mcp" class="footer-link" target="_blank">GitHub</a>
<a href="https://github.com/r3e-network/neo-n3-mcp/discussions" class="footer-link" target="_blank">Discussions</a>
<a href="https://discord.gg/neo" class="footer-link" target="_blank">Discord</a>
</div>
</div>
</div>
<div class="footer-bottom">
<p>© 2025 Neo N3 MCP. Open source under MIT License.</p>
<p>Built with ❤️ for the Neo ecosystem</p>
</div>
</div>
</footer>
<script>
// Navigation scroll effect
window.addEventListener('scroll', () => {
const nav = document.getElementById('nav');
if (window.scrollY > 50) {
nav.classList.add('scrolled');
} else {
nav.classList.remove('scrolled');
}
});
function copyCode(button) {
const codeBlock = button.nextElementSibling.querySelector('pre');
const text = codeBlock.textContent;
navigator.clipboard.writeText(text).then(() => {
button.textContent = 'Copied!';
setTimeout(() => {
button.textContent = 'Copy';
}, 2000);
});
}
</script>
</body>
</html>