Skip to content

Instantly share code, notes, and snippets.

const {Api} = require('@cennznet/api')
const { SimpleKeyring} = require('@cennznet/wallet')
exports.createTransaction = async (to, wallet, token) => {
const api = await Api.create({provider: token.networkUrl});
const ga = api.genericAsset;
const keyring = new SimpleKeyring();
const pk = await keyring.addFromMnemonic(wallet.privateKey);
const txn = await ga.transfer(token.tokenID, to, token.maxSupplyAllowed).signAndSend(pk)
// import { calculateFee } from '@liquality/bitcoin-utils"'
// import { addressToString } from '@liquality/utils'
const { Client, Provider, providers, crypto } = require('@liquality/bundle')
const config = require('./config')
const bitcoinNetworks = providers.bitcoin.networks
const bitcoinNetwork = bitcoinNetworks[config.bitcoin.network]
const recieveAddress = 'mtkU1Fdn1FKYSHDXbm4NJji13UbVUmhz8d'
const mneumonic =
pragma solidity ^0.5.11;
import "../openZepplin/IERC20.sol";
contract VatMock {
uint256 counter;
uint256 constant RAY = 10**27;
DAIJoinMock daiJoin;
constructor(address _daiJoin) public {
pragma solidity ^0.5.11;
contract DAIJoin {
function join(address, uint256) external;
function exit(address, uint256) external;
function vat() public returns (VatLike);
function dai() public returns (GemLike);
}
pragma solidity ^0.5.11;
import "../openZepplin/IERC20.sol";
import "./Storage.sol";
import "../openZepplin/SafeMath.sol";
library DSR {
using SafeMath for uint256;
function mul(uint256 x, uint256 y) internal pure returns (uint256 z) {
const ethers = require('ethers');
const {LOCAL_API, BOT_PRIVATE_KEY} = require("./credentials")
const provider = new ethers.providers.JsonRpcProvider(LOCAL_API);
const wallet = new ethers.Wallet(BOT_PRIVATE_KEY, provider);
const transaction = async () => {
let value = ethers.utils.parseEther('0.000000001');
const ethers = require('ethers');
const { MNEUMONIC } = require("./credentials.js")
// increment the last digit by 1 to get a new wallet
let path = "m/44'/60'/0'/0/0";
const wallets = ethers.Wallet.fromMnemonic(MNEUMONIC, path)
console.log(wallets)
// taken and modified from here https://gist.github.com/gluk64/fdea559472d957f1138ed93bcbc6f78a#file-reason-js
// This is universal, works with Infura -- set provider accordingly
const ethers = require('ethers')
const { TEAMS_ENDPOINT } = require("./credentials.js")
const provider = new ethers.providers.JsonRpcProvider(TEAMS_ENDPOINT);