Skip to content

Instantly share code, notes, and snippets.

Tried to think of an easy to implement game idea after today's lunch discussion with @palango . So, this is what I got:

Team-based RockPaperScissors Idea:

  • 2 teams with unlimited number of participants
  • each game finalizes after 1 round
  • each team can pick one of rock, paper, scissors
  • each team picks the move based on a majority of votes of the team members
  • each team member sends the move & an off-chain payment
const baseUrl = 'http://192.168.1.141:5000/api/v1';
const httpClient = axios;
const web3 = undefined;
let i_id_1 = null;
const pets_id_get_1 = async function(id) {
const url = `${baseUrl}/pets/${id}`;
const baseUrl = 'http://192.168.1.141:5000/api/v1';
const httpClient = axios;
// const web3 = undefined;
let i__to_0 = null;
let i__value_0 = null;
let i__owner_1 = "0xbB5AEb01acF5b75bc36eC01f5137Dd2728FbE983";
// Metamask
let baseUrl;
const httpClient = axios;
let filter_Transfer_0 = {};
// Metamask
const provider = new ethers.providers.Web3Provider(web3.currentProvider);
const signer = provider.getSigner();
/*
browser/dType_V2.sol:52:29: TypeError: Invalid type for argument in function call. Invalid implicit conversion from bytes24 to function (struct typeALib.TypeA memory) pure external returns (struct typeALib.TypeA memory) requested.
return typeALib.map(signature, typeAarr);
^-------^
*/
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
library typeALib {
@loredanacirstea
loredanacirstea / CurryExample_yul.sol
Created April 27, 2020 11:41
Curried Function example in Yul
object "ContractB" {
code {
datacopy(0, dataoffset("Runtime"), datasize("Runtime"))
return(0, datasize("Runtime"))
}
object "Runtime" {
code {
let _calldata := 2048
let _output_pointer := 0
@loredanacirstea
loredanacirstea / HOFsExample_yul.sol
Last active May 5, 2020 08:49
HOFs Example in Yul
object "ContractB" {
code {
datacopy(0, dataoffset("Runtime"), datasize("Runtime"))
return(0, datasize("Runtime"))
}
object "Runtime" {
code {
let _calldata := 2048
let _output_pointer := 0
@loredanacirstea
loredanacirstea / TaylorInteract.js
Created May 5, 2020 08:46
Script to interact with the Taylor interpreted contract
const address = '0x7D4150f492f93e2eDD7FC0Fc62c9193b322f75e5'
let provider = ethers.getDefaultProvider('ropsten');
const newUint8 = '0xffffffff11000001';
const newUint32Array3 = '0xffffffff44000000ee000002000000070000000f110000030000042200000411000004';
const castArrayInt32ToUint256 = '0xffffffff77777788ee0000020000000c000000202200000844000003110000204400000312000004000000020000000500000004';
const data = castArrayInt32ToUint256;
@loredanacirstea
loredanacirstea / yulToEwasm_staticcall.txt
Last active May 19, 2020 20:40
Yul -> ewasm with staticcall (staticcall not included in the bytecode); solc 0.6.8+commit.0bbfe453.Darwin.appleclang
======= initial Yul source =======
object "TestWasm9_2" {
code {
datacopy(0, dataoffset("Runtime"), datasize("Runtime"))
return(0, datasize("Runtime"))
}
object "Runtime" {
code {
let _calldata := 96
@loredanacirstea
loredanacirstea / yulToEwasm_div_bug.txt
Created May 17, 2020 13:39
yulToEwasm - div with calldata argument bug
solc --version
0.6.8+commit.0bbfe453.Darwin.appleclang
solc --strict-assembly --optimize --yul-dialect evm --machine ewasm ./tests/contracts/taylor.yul
-> const wmodule = new WebAssembly.Module(hexToUint8Array(bytecode));
CompileError: WebAssembly.Module(): Compiling function #9 failed: expected 1 elements on the stack for return, found 0 @+987
======= ./tests/contracts/taylor.yul - initial source =======