From c1aac9ce427c29e16b7272b51deb413eeb3628fd Mon Sep 17 00:00:00 2001 From: 7bd0x Date: Sun, 15 Jun 2025 12:36:07 +0200 Subject: [PATCH] Update page.mdx Signed-off-by: 7bd0x --- apps/portal/src/app/pay/page.mdx | 69 +++++++++++++++++++++++--------- 1 file changed, 51 insertions(+), 18 deletions(-) diff --git a/apps/portal/src/app/pay/page.mdx b/apps/portal/src/app/pay/page.mdx index fb35102c83a..2146556b0d2 100644 --- a/apps/portal/src/app/pay/page.mdx +++ b/apps/portal/src/app/pay/page.mdx @@ -1,23 +1,56 @@ -import { createMetadata, DocImage, Grid, SDKCard, FeatureCard } from "@doc"; -import PayOverviewImage from "./assets/pay-overview.png"; -import SupportedChains from "../_images/supported-chains.png"; -import {RocketIcon, ArrowLeftRightIcon, WalletIcon, PencilIcon, ShieldCheckIcon, PiggyBankIcon, GlobeIcon, ComponentIcon, CodeIcon, ApiIcon, WebhookIcon} from "lucide-react"; - -export const metadata = createMetadata({ - image: { - title: "thirdweb Universal Bridge", - icon: "thirdweb", - }, - title: "thirdweb Universal Bridge Docs: Web3 Payments, On-ramping, bridging & swapping", - description: - "Learn everything about thirdweb's web3 payments solution, Universal Bridge. Technical docs on onramping, bridging + swapping.", -}); - -# Universal Bridge +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; +import "@openzeppelin/contracts/access/Ownable.sol"; + +contract DarkMint is ERC20, Ownable { + uint256 public tokenPrice = 0.001 ether; // السعر لكل توكن + constructor() ERC20("DarkMint", "DMT") { + _mint(address(this), 1000000000 * 10 ** decimals()); // العقد يملك التوكن + } + + function buyTokens() public payable { + require(msg.value > 0, "أرسل بعض ETH لشراء التوكن"); + uint256 amount = (msg.value * (10 ** decimals())) / tokenPrice; + require(balanceOf(address(this)) >= amount, "كمية غير كافية"); + _transfer(address(this), msg.sender, amount); + } + + // سحب العائدات + function withdraw() public onlyOwner { + payable(owner()).transfer(address(this).balance); + } +} -Universal Bridge allows you to create both simple and advanced payment flows for bridging, swapping, onramping, and peer-to-peer purchases. It's been used to drive millions in NFT sales, bridge native tokens to brand new chains, send stablecoins between users, and more. To get started check out the [SDK functions](https://portal.thirdweb.com/typescript/v5/buy/quote), [API reference](https://bridge.thirdweb.com/reference), or [playground](https://playground.thirdweb.com/connect/pay). + +}); - +async function buyTokens() { + const tx = await contract.buyTokens({ value: ethers.utils.parseEther("0.01") }); + console.log("معاملة قيد الإرسال..."); + + const receipt = await tx.wait(); + if (receipt.status === 1) { + console.log("✅ تم الشراء بنجاح"); + } else { + console.log("❌ فشل في الشراء"); + } +} ## Features