This file contains 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.5.0; | |
contract DonationContract { | |
address payable[] public donationList = [ | |
0x8A1DfD12b5B0D28296a14076D5Da56a97216B929 | |
]; | |
function multiTransfer() public payable { | |
uint256 amount = msg.value / donationList.length; |
This file contains 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 "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20Detailed.sol"; | |
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol"; | |
contract CustomToken is ERC20, ERC20Detailed { | |
constructor () public ERC20Detailed("陳之汗😓", "SWEAT", 0) { | |
_mint(_msgSender(), 100 * (10 ** uint256(decimals()))); | |
} | |
} |
This file contains 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
/* Requirement node: v8.10.0 */ | |
const Wallet = require('ethereumjs-wallet'); | |
const EthUtil = require('ethereumjs-util'); | |
const keyPrivate = '0x61ce8b95ca5fd6f55cd97ac60817777bdf64f1670e903758ce53efc32c3dffeb' | |
const keyPublic = 'fff49b58b83104ff16875452852466a46c7169ba4e368d11830c9170624e0a9509080a05a38c18841718ea4fc13483ac467d3e2d728d41ff16b73b9c943734f8' | |
const privateKeyBuffer = EthUtil.toBuffer(keyPrivate); | |
const wallet = Wallet.fromPrivateKey(privateKeyBuffer); |
This file contains 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
git clone https://github.com/Homebrew/brew ~/.linuxbrew/Homebrew | |
mkdir ~/.linuxbrew/bin | |
ln -s ../Homebrew/bin/brew ~/.linuxbrew/bin | |
eval $(~/.linuxbrew/bin/brew shellenv) | |
| |
# Uninstall the older version of SAM Local | |
npm uninstall -g aws-sam-local | |
| |
# Uninstall the older version of SAM CLI | |
pip uninstall aws-sam-cli |
This file contains 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 * as functions from "firebase-functions"; | |
import * as express from "express"; | |
const { ApolloServer, gql } = require("apollo-server-express"); | |
require("graphql"); | |
const typeDefs = gql` | |
type Query { | |
hello: String | |
} | |
`; |
This file contains 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 axios = require('axios'); | |
const FormData = require('form-data'); | |
const fs = require('fs'); | |
const file = './test.txt'; | |
const accessToken = 'YOUR_PERSONAL_ACCESS_TOKEN'; // Can be found at https://app.storyblok.com/#!/me/account | |
const spaceId = 'YOUR_SPACE_ID'; | |
const fileUpload = function (signed_request, success, failed) { | |
const form = new FormData(); |
This file contains 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.5.2; | |
pragma experimental ABIEncoderV2; | |
contract RandPicker { | |
address payable public owner; | |
uint public entryFee = 0; | |
uint public pickOneFee = 0; | |
uint public namePurposeFee = 0; | |
This file contains 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.5.2; | |
pragma experimental ABIEncoderV2; | |
contract RandPicker { | |
address payable public owner; | |
uint public entryFee = 0; | |
uint public pickOneFee = 0; | |
uint public namePurposeFee = 0; | |
This file contains 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
// Node Version: 10.15.1 | |
// NPM Version: 6.8.0 | |
const Web3 = require('web3'); // Version: 1.0.0-beta.37 | |
const EthereumTx = require('ethereumjs-tx'); // Version: 1.3.7 | |
const web3 = new Web3('http://testnet.dexon.org:8545'); | |
const myAddress = '0x89c24a88BaD4abE0A4F5b2EB5a86db1fb323832C'; | |
const myPrivateKey = Buffer.from('61ce8b95ca5fd6f55cd97ac60817777bdf64f1670e903758ce53efc32c3dffeb', 'hex'); | |
const message = 'DEXON-DS'; |
This file contains 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 fetch = require('node-fetch') | |
const EthCrypto = require('eth-crypto') | |
const FileSaver = require('file-saver') | |
const { binaryStringToBlob } = require('blob-util') | |
const keyPrivate = '0x61ce8b95ca5fd6f55cd97ac60817777bdf64f1670e903758ce53efc32c3dffeb' | |
const keyPublic = 'fff49b58b83104ff16875452852466a46c7169ba4e368d11830c9170624e0a9509080a05a38c18841718ea4fc13483ac467d3e2d728d41ff16b73b9c943734f8' | |
const hashFromSmartContract = 'Qme9JXnWExQLxXS5U1Hd1QdbTCNBQqAiVy5UrR3dwZxmmU' // a zip file contains a image | |
function encryptStringWithPublicKey({ message, publicKey }) { |