Skip to content

Instantly share code, notes, and snippets.

View marekkirejczyk's full-sized avatar

Marek Kirejczyk marekkirejczyk

View GitHub Profile
@marekkirejczyk
marekkirejczyk / erc1077.js
Created November 1, 2018 14:58
ERC 1077 calls from js
/* raw js call */
data = subscriptionModule.createSubscription(...).encode();
identity.executeSigned(subscriptionModule.address, 0, data, nonce,
gasPrice,
gasToken,
gasLimit,
DELEGATE_CALL,
bytes extraData,
bytes signatures);
@marekkirejczyk
marekkirejczyk / ERC1077.sol
Last active November 2, 2018 11:12
ERC1077 Modules
contract IERC1077 {
enum OperationType {CALL, DELEGATECALL, CREATE}
event ExecutedSigned(bytes32 executionId, address from, uint nonce, bool success);
function lastNonce() public view returns (uint nonce);
address [] modules;
function canExecute(
@marekkirejczyk
marekkirejczyk / IERC1077.sol
Created October 19, 2018 14:40
ERC1077 - draft 0.01
pragma solidity ^0.4.24;
contract IERC1077 {
enum OperationType {CALL, DELEGATECALL, CREATE}
event ExecutedSigned(bytes32 executionId, address from, uint nonce, bool success);
function lastNonce() public view returns (uint nonce);
@marekkirejczyk
marekkirejczyk / SolidityCheatSheet.sol
Created March 18, 2018 10:55
Solidity Cheat Sheet
// A single line comment
/*
A multiline comment
*/
pragma solidity ^0.4.21; //Solidity version supported
contract ExampleContract {
@marekkirejczyk
marekkirejczyk / .eslintrc.json
Created February 19, 2018 13:45
.eslintrc.json
{
"parser": "babel-eslint",
"parserOptions": {},
"plugins": [
"import"
],
"env": {
"node": true,
"es6": true
},
pragma solidity 0.4.18;
contract TossCoin {
address player1;
address player2;
address oracle;
uint value;
function TossCoin(address _oracle) payable public {
Parent:
window.addEventListener('message', function(event) {
console.log(event.data);
});
Child:
setInterval(function() {
parent.postMessage("Hello",'*');
Parent:
var frame = document.getElementById('test');
r = frame.contentWindow.postMessage("DUPA", '*');
Child:
window.addEventListener('message', function(event) {
console.log(event.data);
});
pragma solidity ^0.4.16;
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) constant returns (uint256);
function transfer(address to, uint256 value) returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
@marekkirejczyk
marekkirejczyk / uuid_issue
Created June 18, 2016 12:55
Test for: ActiveRecord - no exception is thrown when invalid UUID value is supplied on update!
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'