Skip to content

Instantly share code, notes, and snippets.

/**
based on
https://solidity.readthedocs.io/en/v0.5.14/solidity-by-example.html
*/
pragma solidity >=0.4.22 <0.7.0;
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./Ownable.sol";
contract SafeRemotePurchase is Ownable {
pragma solidity >=0.4.22 <0.7.0;
import "./HitchensUnorderedKeySet.sol";
import "./SafeRemotePurchase.sol";
import "./Ownable.sol";
contract FleaMarketFactory is Ownable {
using HitchensUnorderedKeySetLib for HitchensUnorderedKeySetLib.Set;
HitchensUnorderedKeySetLib.Set private widgetSet;
{
"extends": "solhint:recommended",
"plugins": [],
"rules": {
"avoid-suicide": "error",
"avoid-sha3": "warn",
"avoid-tx-origin:": "warn",
"avoid-throw": "off",
"indent": "off",
"no-mix-tabs-and-spaces": "off"
const FleaMarketContract = artifacts.require("FleaMarketFactory");
module.exports = async (deployer) => {
await deployer.deploy(FleaMarketContract);
const contract = await FleaMarketContract.deployed();
console.log(`Contract has been deployed successfully: ${contract.address}`);
};
var chai = require('chai');
chai.use(require('chai-as-promised')).should();
const BN = web3.utils.BN;
// Enable and inject BN dependency
chai.use(require('chai-bn')(BN));
var expect = chai.expect;
var assert = chai.assert;
var should = chai.should();
@alexytiger
alexytiger / index.ts
Last active December 24, 2019 05:33
e-book
export interface AppState {
router: fromRouter.RouterReducerState<any>;
spinner: fromSpinner.SpinnerState;
error: fromError.ErrorState;
}
@alexytiger
alexytiger / index.ts
Last active February 8, 2020 01:21
e-book
import { ErrorEffects } from './error.effects';
import { SnackBarEffects } from './snack-bar.effect';
import { SpinnerEffects } from './spinner.effect';
export const effects: any[] = [ErrorEffects, SnackBarEffects, SpinnerEffects];
export * from './error.effects';
export * from './snack-bar.effect';
export * from './spinner.effect';
import { Injectable } from '@angular/core';
import { Actions, ofType, createEffect } from '@ngrx/effects';
import { tap, map } from 'rxjs/operators';
import { ErrorActions, SnackBarActions } from '../actions';
import { AppearanceColor, SnackBarInterface } from '../../models';
@Injectable()
export class ErrorEffects {
constructor(private readonly actions$: Actions) {
import { createAction, props } from '@ngrx/store';
import { SnackBarInterface } from '../../models';
export const open = createAction('[SnackBar] Open', props<{ payload: SnackBarInterface }>());
import { InjectionToken} from '@angular/core';
export const MetamaskEthereumToken = new InjectionToken(
'MetaMask Web3 provider',
{
providedIn: 'root',
factory: () => {
const ethereum = (window as any).ethereum;
// Returns true or false, representing whether the user has MetaMask installed.