Aprende a crear una tienda virtual Blockchain paso a paso (Acepta pagos con token ERC20)
En este video voy a darte un paso a paso de como crear una tienda virtual Blockchain en la red de Ethereum, la principal característica es la de aceptar cripto pagos con los tokens ERC20, vamos a ir desde: crear los contratos inteligentes, crear el backend y por último el frontend.
Para el contrato inteligente vamos a usar #solidity, la librería de #openzeppelin y el framework #truffle.
Para el backend vamos a usar Node.js y el framework Express.js
Y por último para el frontend sencillamente react.js y Bootstrap como framework de css.
Hay muchas tecnologías involucradas para crear esta tienda virtual, será muy divertido como estas diferentes tecnologías se unen para dar vida a esta dapp.
Solidity.
Contrato PaymentProcessor.sol:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract PaymentProcessor is Ownable {
IERC20 public dai;
event PaymentDone(address payer, uint amount, uint paymentId, uint date);
constructor(address _dai) {
dai = IERC20(_dai);
}
function Pay(uint amount, uint paymentId) external {
dai.transferFrom(msg.sender, owner(), amount);
emit PaymentDone(msg.sender, amount, paymentId, block.timestamp);
}
}
Contrato Dai.sol (mock):
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract Dai is ERC20 {
constructor() ERC20("Dai Stable Coin", "DAI"){}
function faucet(address to, uint amount) external{
_mint(to, amount);
}
}
▶️ 3Speak
Leave Aprende a crear una tienda virtual Blockchain paso a paso (Acepta pagos con token ERC20) to:
Read more #programming posts
Best Posts From jfdesousa7
We have not curated any of jfdesousa7's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From jfdesousa7
- Today is selfie day 😌
- Strolling through "el Laguito" Park 🍃
- Probando la nueva actualizacion de NextJS 13
- Tennis day in the club (San Miguel / Maturin)
- My innocent puppy
- Aprende a subir tu aplicacion de NextJs a un Hosting Compartido (Cpanel)
- Severance - Everyone Should Watch the Absolute Best Show on Apple TV Plus
- Tutorial - React Redux App + Solidity desde cero. Metamask-Ethers
- Tutorial - Breve Introducción a Redux
- Parte 2 (Backend) - Aprende a crear una tienda virtual Blockchain aceptando ERC20 token