Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Ashish 0xAshish

🎯
Focusing
View GitHub Profile
@0xAshish
0xAshish / 2018-photo.md
Created Jan 2, 2018 — forked from usmanakram232/2018-photo.md
52 Week Photography Challange 2018
View 2018-photo.md

52 Week Photography Challange 2018

This year again photographer Dale Foshe has put up 52 week photography chanllange here.

Following, I just list them again for my ease of use. 😆

  • Week 1 Vision: Look Ahead New year. New beginnings. New you. Look ahead. Interpret as you wish.
  • Week 2 Composition: Color Harmony Get out your color wheel. Do opposites attract? Can there be harmony with opposite colors? Does the Hulk wear purple pants? Mix warm and cool colors.
  • Week 3 Technical: Full Manual While the camera often determines shutter speed and aperture for the photographer, it doesn't know your creative intent. This week, challenge your self to assume creative control over the camera by using full manual mode. Select a subject where varying the aperture and / or shutter speed helps enhance the composition and visual qualities of the image.
  • Week 4 Creative: Quiet Moment Peace
View Validatorset.sol
pragma solidity ^0.4.24;
import { SafeMath } from "openzeppelin-solidity/contracts/math/SafeMath.sol";
import {RLP} from "../lib/RLP.sol";
import { RLPEncode } from "../lib/RLPEncode.sol";
import { BytesLib } from "../lib/BytesLib.sol";
contract ValidatorSet {
using SafeMath for uint256;
using SafeMath for uint8;
// using BytesLib for bytes32;
View erc20.sol
pragma solidity ^0.4.24;
// ----------------------------------------------------------------------------
// '0Fucks' token contract
//
// Deployed to : 0x5A86f0cafD4ef3ba4f0344C138afcC84bd1ED222
// Symbol : 0FUCKS
// Name : 0 Fucks Token
// Total supply: 100000000
// Decimals : 18
@0xAshish
0xAshish / Faucet.sol
Last active Jan 5, 2019
faucet for erc20 and ETH
View Faucet.sol
pragma solidity ^0.4.24;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address private _owner;
View custom_logic_in_child_token_contract.sol
pragma solidity ^0.4.24;
//interface for parent contract of any child token
/*
parent contract interface for adding custom logic
before making transaction in erc721/erc20 child chain contract
transfer, transferFrom executes beforeTransfer of this interface contract
it must follow this interface and return a boolean and in case of ERC20 contracts
it should not have require statement and instead return false
View plasma_in_flight_exit
plasma in-flight exit approach
- on mainchain user starts exit with tx-data(user signed and submited) and exits with last amount(in erc20)
- user also plases a bond amount
- there is fraud-prrof if user tries to exit with fraudulent tx then operator can submit in-flight tx with same nonce
- this prevents fraud from operator side
- obviusly user won't exit with fake tx(where he is sending amount to someone) with less amount then his last accepted tx amount
- if user tries to exit with any previous tx then in-flight tx then operator or anyone with greater nonce tx can strat challenge
and get bond amount and cancels exit
- what happens when user and operator colludes ?
View StakeManager.sol
contract StakeManager is IStakeManager {
using SafeMath for uint256;
using ECVerify for bytes32;
event ThresholdChange(uint256 newThreshold, uint256 oldThreshold);
event DynastyValueChange(uint256 newDynasty, uint256 oldDynasty);
// optional event to ack unstaking
event UnstakeInit(uint256 indexed validatorId, address indexed user, uint256 indexed amount, uint256 deactivationEpoch);
View temp.js
import 'isomorphic-fetch'
import Web3 from 'web3'
import utils from 'ethereumjs-util'
import queryString from 'query-string'
import Trie from 'merkle-patricia-tree'
import EthereumTx from 'ethereumjs-tx'
import EthereumBlock from 'ethereumjs-block/from-rpc'
import {
View erc721full.js
[
{
"constant": true,
"inputs": [
{
"name": "interfaceId",
"type": "bytes4"
}
],
"name": "supportsInterface",
View asmcall.sol
contract a {
uint256 gasLimit = 2400;
function doThis() public {
address _token = address(0x3);
address depositManager = address(new b());
address exitOwner = address(0x2);
uint256 amount = 2323;
uint256 one = 1;
// uint256 gasLimit = 2400;