Skip to content

Instantly share code, notes, and snippets.

View GrandSchtroumpf's full-sized avatar
🏠
Working from home

François GrandSchtroumpf

🏠
Working from home
  • Dapps Nation
  • Nantes
View GitHub Profile
@GrandSchtroumpf
GrandSchtroumpf / Project.sol
Last active November 19, 2019 09:12
A naive Solidity contract that manages funds for a project
pragma solidity >=0.5.0 <0.6.0;
// 10000000000000000000 // 10 Ethers
contract Project {
// The address who deployed the contract
address private owner;
// The cap to achieved to fund the project
uint public cap;
// The total funded.
@GrandSchtroumpf
GrandSchtroumpf / plugin-ws.js
Created November 4, 2019 10:55
Exemple using plugin-ws
const pluginWs = require('@remixproject/plugin-ws')
const express = require('express')
const ws = require('express-ws')
const bodyParser = require('body-parser');
const cors = require('cors');
const app = express()
ws(app)
app.use(bodyParser.urlencoded({extended: true}))
@GrandSchtroumpf
GrandSchtroumpf / fireauth.service.preview.ts
Created September 9, 2019 13:02
Preview of Firebase Auth Service
import { inject } from '@angular/core';
import { AngularFireAuth } from '@angular/fire/auth';
import { AngularFirestore, AngularFirestoreCollection } from '@angular/fire/firestore';
import { auth, User } from 'firebase';
import { switchMap, tap } from 'rxjs/operators';
import { Observable, of, combineLatest } from 'rxjs';
import { Store } from '@datorama/akita';
export const fireAuthProviders = ['github', 'google', 'microsoft', 'facebook', 'twitter' , 'email'] as const;
{
"accounts": {
"account{0}": "0xca35b7d915458ef540ade6068dfe2f44e8fa733c"
},
"linkReferences": {},
"transactions": [
{
"timestamp": 1563522532175,
"record": {
"value": "0",
@GrandSchtroumpf
GrandSchtroumpf / ERC20.sol
Created July 18, 2019 15:06
Base code for meetup
pragma solidity >=0.5.0 <0.6.0;
import "https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol";
contract ERC20 {
using SafeMath for uint256;
uint256 private _totalSupply;
mapping(address => uint256) private _balances;
event Transfer(address indexed from, address indexed to, uint256 amount);
pragma solidity >=0.5.0 <0.6.0;
import "https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol";
contract ERC20 {
using SafeMath for uint256;
uint256 private _totalSupply;
mapping(address => uint256) private _balances;
event Transfer(address indexed from, address indexed to, uint256 amount);
@GrandSchtroumpf
GrandSchtroumpf / metadata.json
Last active July 2, 2019 14:58
Metadata for workshop1
{
"name": "Workshop 1",
"description": "Workshop for very beginner",
"author": "GrandSchtroumpf",
"stepIds": ["ea9f23cf4a50b4ea8899b75a198daeea"]
}
@GrandSchtroumpf
GrandSchtroumpf / step1.md
Created July 2, 2019 13:43
Step 1 - Discover Solidity

Discover Solidity

This is a simple Markdown File to test Remix Workshops

@Component({
selector: 'app-root',
template: `
<ul>
<li *ngFor="let todo of todos$ | async">{{ todo.label }}</li>
<button (click)="add()">Add todo</button>
</ul>
`
})
export class AppComponent implements OnInit {
@GrandSchtroumpf
GrandSchtroumpf / todo.service.ts
Last active June 26, 2019 11:06
TodoService extends CollectionService
...
import { CollectionService, CollectionConfig } from 'akita-firebase';
@Injectable({ providedIn: 'root' })
@CollectionConfig({ path: 'todos' })
export class TodosService extends CollectionService<TodoState> {
constructor(db: AngularFirestore, store: TodoStore) {
super(db, store);
}
}