Skip to content

Instantly share code, notes, and snippets.

View leonprou's full-sized avatar
🎯
On target

Leon Prouger leonprou

🎯
On target
  • Tel Aviv
  • 05:30 (UTC +03:00)
View GitHub Profile
@leonprou
leonprou / erc20.sol
Created October 15, 2020 13:11
erc20.sol
pragma solidity >=0.4.22 <0.6.0;
interface tokenRecipient {
function receiveApproval(address _from, uint256 _value, address _token, bytes calldata _extraData) external;
}
contract TokenERC20 {
// Public variables of the token
string public name;
string public symbol;
@leonprou
leonprou / syncing EoC on Mainnet
Created September 26, 2020 16:12
Syncing Fuse with Ethereum.md
Clone the repo and install the dependencies
```
git clone https://github.com/fuseio/fuse-bridge
cd fuse-bridge
git checkout feature/find-not-relayed-messages
cd fuse-bridge/native-to-erc20/oracle
npm install
```
Fuse and Ethereum networks are connected via the bridge that relay messages from Fuse network to Ethereum.
@leonprou
leonprou / rewind fuseoracle-initiate-change
Created July 16, 2020 18:15
To sync the end of cycle on Fuse, you need to set the last processed block to the end of cycle that suceeded
# stop the container
docker stop fuseoracle-initiate-change
# open the redis CLI
sudo docker-compose exec redis redis-cli
# check that the redis key is correct (should be not nil)
GET native-erc-initiate-change:lastProcessedBlock
# set to a new value. 5831273 is currently the last relayed block on Mainnet.
SET native-erc-initiate-change:lastProcessedBlock 5831273
@leonprou
leonprou / rewind fuseoracle-initiate-change
Created July 16, 2020 18:15
To sync the end of cycle on Fuse, you need to set the last processed block to the end of cycle that suceeded
# stop the container
docker stop fuseoracle-initiate-change
# open the redis CLI
sudo docker-compose exec redis redis-cli
# check that the redis key is correct (should be not nil)
GET native-erc-initiate-change:lastProcessedBlock
# set to a new value. 5831273 is currently the last relayed block on Mainnet.
SET native-erc-initiate-change:lastProcessedBlock 5831273
#docker stop $CONTAINER_NAME
# open the redis CLI
sudo docker-compose exec redis redis-cli
# check the current blocknumber of the $CONRAINER_ID:lastProcessedBlock
GET $CONRAINER_ID:lastProcessedBlock
# set to a new value. 5831273 is the current last relayed block on Mainnet.
SET $CONRAINER_ID:lastProcessedBlock 5831273
# close the redis CLI
const { request } = require('graphql-request')
const axios = require('axios')
const getAccountCharacters = async accountName => {
var options = {
method: 'POST',
url: 'https://www.pathofexile.com/character-window/get-characters',
headers: {
authority: 'www.pathofexile.com',
accept: 'application/json, text/javascript, */*; q=0.01',
0xD418c5d0c4a3D87a6c555B7aA41f13EF87485Ec6
@leonprou
leonprou / pk_from_mnemonic.js
Last active July 30, 2020 14:17
Private key from mnemonic
require('ethereumjs-wallet/hdkey').fromMasterSeed(m).deriveChild(i).getWallet().getAddressString()
require('ethereumjs-wallet/hdkey').fromMasterSeed(m).deriveChild(i).getWallet().getPrivateKeyString()
for (let i = 0; i < 15; i++) {
console.log(`${i}: ${require('ethereumjs-wallet/hdkey').fromMasterSeed(m).deriveChild(i).getWallet().getAddressString()}`)
}
@leonprou
leonprou / decodeContractLogsToEvents.js
Last active September 22, 2019 11:23
decode logs of web3js contract to events
const isArray = require('lodash/isArray')
const logsToEvents = (logs, contract) => {
if (isArray(logs)) {
const events = {}
logs.forEach((log, index) => {
log = contract.events.allEventsLogDecoder.decode(contract.abiModel, log)
if (log.event) {
" Specify a directory for plugins
" - For Neovim: ~/.local/share/nvim/plugged
" - Avoid using standard Vim directory names like 'plugin'
set number
let g:typescript_indent_disable = 1
call plug#begin('~/.vim/plugged')
Plug 'scrooloose/nerdtree'