This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState,useEffect } from "react"; | |
import { useRouter } from 'next/router'; | |
import clsx from "clsx"; | |
import { useWeb3Context } from '../../context' | |
import WalletConnectorDialog from "./WalletConnectorDialog"; | |
import WalletConnectorDialogNew from "./WalletConnectorDialogNew"; | |
import httpRequest from '@/common/utils/httpRequest'; | |
import showToast from '@/common/utils/showToast'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const openpgp = require('openpgp'); | |
// Generate a new key pair (public key and private key) | |
const { privateKeyArmored, publicKeyArmored } = await openpgp.generateKey({ | |
type: 'rsa', | |
userIDs: [{ name: 'John Doe', email: '[email protected]' }], | |
passphrase: 'mySecretPassphrase', | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Import required libraries | |
const crypto = require('crypto'); | |
const fs = require('fs'); | |
// Generate a random large prime number (p) and a primitive root (g) | |
const p = crypto.createDiffieHellman(256).getPrime(); | |
const g = 2; | |
// Alice's secret key (a), alice is PTG as a data supplier | |
const a = crypto.randomBytes(32); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Define the list of IPs | |
$processes = ['IP1', 'IP2', 'IP3', 'IP4', 'IP5']; | |
// Define the time slice for each IP | |
$timeSlice = 2; | |
// Define the current process index | |
$currentProcessIndex = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//SPDX-License-Identifier: MIT | |
pragma solidity 0.8.7; | |
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; | |
import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; | |
import "@openzeppelin/contracts/security/Pausable.sol"; | |
import "@openzeppelin/contracts/access/Ownable.sol"; | |
import "@openzeppelin/contracts/access/AccessControl.sol"; | |
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// import React from 'react'; | |
import { useEffect, useState } from 'react' | |
// import styled from 'styled-components' | |
import { MuiCardStyled } from '@/styles/mui.styled'; | |
// import { CenteredText, TicketNumberBox } from '@/styles/lottery.styled'; | |
import useTotalRewards from '@/hooks/useTotalRewards'; | |
import { getBalanceNumber } from '@/utils/formatBalance'; | |
import { BallWithNumber } from '../../svgs' | |
import { BallColor } from '../../svgs/Balls' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require("dotenv").config() | |
const ethers = require('ethers') | |
const {ChainId, Token, TokenAmount, Fetcher, Pair, Route, Trade, TradeType, Percent} = | |
require('@pancakeswap-libs/sdk'); | |
const Web3 = require('web3'); | |
const web3 = new Web3('wss://apis.ankr.com/wss/c40792ffe3514537be9fb4109b32d257/946dd909d324e5a6caa2b72ba75c5799/binance/full/main'); | |
const {JsonRpcProvider} = require("@ethersproject/providers"); | |
const provider = new JsonRpcProvider('https://bsc-dataseed1.binance.org/'); | |
const { address: admin } = web3.eth.accounts.wallet.add(process.env.PRIVATE_KEY) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// EscrowBNBContract | |
// https://testnet.bscscan.com/address/0x3e8ae7bf5a73b23bfd48bb8362ed55df079d11db#code | |
// BSC | |
const BSCMainnetUrl = process.env.BSC_MAINNET_URL | |
const BSCTestnetUrl = process.env.BSC_TESTNET_URL | |
const BSCPrivateKey = process.env.PRIVATE_KEY_BSC; | |
const BSCProvider = new ethers.providers.JsonRpcProvider(BSCTestnetUrl) | |
const BSCWallet = new ethers.Wallet(BSCPrivateKey); | |
const BSCAccount = BSCWallet.connect(BSCProvider); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const EthereumTx = require('ethereumjs-tx'); | |
// raw transaction data | |
const rawTx = '0xf86d8202b28477359400825208944592d8f8d7b001e72cb26a73e4fa1806a51ac79d880de0b6b3a76400008025a028ef61340bd939bc2e7b2a7b190d114d4c7e8a3d80e95599b63f6821023a9c7f3cf3e1df715f0d5c5b5e8d8b82e3538abf2e5b08cc8c86905b776f5dbb82c7'; | |
// create a new transaction object | |
const tx = new EthereumTx(rawTx); | |
// access the data fields of the transaction | |
console.log(`nonce: ${tx.nonce}`); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.6.0; | |
import "https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol"; | |
contract TokenSwap { | |
// The contract maintains a mapping of user accounts to their token balances | |
mapping (address => uint256) public balances; | |
// The contract maintains a reference to the ERC20 token contract | |
// that is being swapped |