I hereby claim:
- I am tomclose on github.
- I am tomclose (https://keybase.io/tomclose) on keybase.
- I have a public key ASCUBtXcn50zeVGwvfdpKEdIvjbco6XVEGYNMcRitbrZ_go
To claim this, I am signing this object:
| // in application module | |
| module Payments { | |
| import 0x30.Adjudicator; | |
| public validTransition(s1, s2) { | |
| // implement app-specific transition logic | |
| } | |
| public respond(R#Adjudicator.T adjudicator, V#State s1, V#State s2) { | |
| assert(validTransition(s1, s2)); | |
| Adjudicator.respond(move(adjudicator), s1, s2); |
| module Adjudicator { | |
| // the adjudicator explicitly declares the apps it supports | |
| import 0x32.Payments; | |
| import 0x34.Poker; | |
| // etc. | |
| public respond(adj: &mut R#Self.T, s1: &V#State, s2: &V#State) { | |
| // framework checks | |
| // … (not shown) … | |
| // in the adjudicator contract: | |
| function respond(State memory s1, State memory s2) public { | |
| // check that the first state matches the stored challenge | |
| assertHashMatches(s1, stored_challenge_hash); | |
| // framework checks | |
| assertValidSignature(s2); | |
| assertSameAppDefinition(s1, s2); | |
| assertTurnNumIncrements(s1, s2); |
| Field | Data type | Definition / Explanation | |
|---|---|---|---|
| ChainID | unit256 | e.g. ropsten / mainnet | |
| Participants | address[] | participant addresses in signing order | |
| ChannelNonce | uint256 | chosen by the participants to uniquely identify the channel | |
| TurnNum | uint256 | turn number | |
| DefaultOutcome | [address, uint256][] | payouts if the channel is finalized in this state | |
| isFinal | boolean | used to allow instant withdrawals when channel is closed collaboratively | |
| AppDefinition | address | on-chain address of library defining custom application rules | |
| AppData | bytes | application-specific data | |
| Signature | [uint8, bytes32, bytes32] | ECDSA signature of commitment (v, r, s) |
| pragma solidity ^0.5.2; | |
| pragma experimental ABIEncoderV2; | |
| import "fmg-core/contracts/Commitment.sol"; | |
| library StateActionStyle { | |
| using Commitment for Commitment.CommitmentStruct; | |
| struct StateActionAttributes { | |
| address stateActionLibrary; |
| *.sol linguist-language=Solidity |
| require 'benchmark' | |
| def f_func(x); 2*x; end | |
| def f_proc_func; proc {|x| 2*x}; end | |
| f_proc_var = proc {|x| 2*x } | |
| n = 1000000 | |
| Benchmark.bm(7) do |x| | |
| x.report("using function: ") { n.times { |i| f_func(i) } } |
I hereby claim:
To claim this, I am signing this object:
| class FruitImporter | |
| include HashRemapper | |
| remaps 'fruit_name', to: :name | |
| remaps 'id', to: :fruit_store_id | |
| remaps 'coordinates', to: :coordinates_x, value: ->(c) { c[0].to_f if c} | |
| remaps 'coordinates', to: :coordinates_y, value: ->(c) { c[1].to_f if c} | |
| def import(fruit_hash) | |
| Fruit.create(remap(fruit_hash)) |