Skip to content

Instantly share code, notes, and snippets.

View 0xAshish's full-sized avatar
🎯
Focusing

Ashish 0xAshish

🎯
Focusing
View GitHub Profile
Staked(address indexed user, uint256 indexed validatorId, uint256 indexed activatonEpoch, uint256 amount, uint256 total);
Staked(address,uint256,uint256,uint256,uint256)
0x9cfd25589d1eb8ad71e342a86a8524e83522e3936c0803048c08f6d9ad974f40
Unstaked(address indexed user, uint256 indexed validatorId, uint256 amount, uint256 total);
Unstaked(address,uint256,uint256,uint256)
0x204fccf0d92ed8d48f204adb39b2e81e92bad0dedb93f5716ca9478cfb57de00
SignerChange(uint256 indexed validatorId, address indexed newSigner, address indexed oldSigner)
SignerChange(uint256,address,address)
pragma solidity ^0.4.24;
contract RootChain {
//
// Constructor
//
constructor () public {
var Dagger = require("eth-dagger");
var Web3 = require("web3");
var contractJSON = require("./../contracts/SocialBet.json");
let MaticWETHContract =require("./MaticWETHContract.json");
var web3 = new Web3("https://testnet2.matic.network");
var dagger = new Dagger("wss://matic.dagger2.matic.network"); // dagger server
const MaticWETHAddress = '0x31074c34a757a4b9FC45169C58068F43B717b2D0';
const web3MaticWETHContract = new web3.eth.Contract(MaticWETHContract.abi, MaticWETHAddress);
import Web3 from 'web3'
// contract abi
import * as Ring from './abi/ring.json'
import * as Item from './abi/item.json'
import * as Unit from './abi/Unit.json'
const addresses = [
'0x972e633f5f6f62d1f2a13977f113941fcb3b606b',
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 {
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;
[
{
"constant": true,
"inputs": [
{
"name": "interfaceId",
"type": "bytes4"
}
],
"name": "supportsInterface",
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 {
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);
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 ?