Aprende a crear una tienda virtual Blockchain paso a paso (Acepta pagos con token ERC20)

3

  • 11
  • 0
  • 0.223
  • Reply

  • Open in the desktop app ADD TO PLAYLIST

    jfdesousa7

    Published on May 17, 2022
    About :

    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);
    }
    

    }

    Tags :

    programming technology development geek geekzone programacion developspanish

    Woo! This creator can upvote comments using 3speak's stake today because they are a top performing creator! Leave a quality comment relating to their content and you could receive an upvote worth at least a dollar.

    Their limit for today is $0!
    Comments:
    Time until jfdesousa7 can give away $0 to their commenters.
    0 Days 0 Hours 0 Minutes 0 Seconds
    Reply:

    To comment on this video please connect a HIVE account to your profile: Connect HIVE Account

    04:49
    1 views 2 years ago $

    More Videos

    00:27
    5 views 5 months ago $
    05:04
    3 views 2 years ago $
    00:55
    1 views 8 months ago $
    01:59
    4 views 2 years ago $
    13:44
    0 views 2 years ago $