View RandomStorage.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
contract RandomStorage { | |
mapping(bytes32 => bytes32) internal data; | |
event ReadEvent(bytes32 k, bytes32 v); | |
constructor() {} |
View SapphireShuffle.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.18; | |
contract SapphireShuffle { | |
address private constant RANDOM_BYTES = 0x0100000000000000000000000000000000000001; | |
error ErrorGeneratingRandom(); | |
function _random_bytes32() |
View WW.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: AGPL-3.0-or-later | |
pragma solidity ^0.8.9; | |
contract WW | |
{ | |
event EncryptedResponse(bytes32 nonce, bytes data); | |
event PublicKey(bytes32 x25519_public); | |
struct Coupon { |
View wrose-example.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import z3 | |
s = z3.Solver() | |
bvp = 256 | |
bvs = 2**bvp | |
balanceOf_signer = z3.BitVec('balanceOf_signer', bvp) | |
wad = z3.BitVec('wad', bvp) | |
reward = z3.BitVec('reward', bvp) | |
contract_balance = z3.Int('contract_balance') # z3.IntVal((10**18) * 4.48) | |
# Calculate balance of user after performing withdrawal |
View E2Example.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.8.9; | |
contract E2Example | |
{ | |
event EncryptedResponse(bytes32 nonce, bytes data); | |
event DecryptedInput(uint256 a, uint256 b, uint256 c); | |
event PublicKey(bytes32 x); |
View download-solc.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if [[ -z $1 ]]; then | |
>&2 echo "Usage: `basename $0` [N.M|latest]" | |
>&2 echo "" | |
>&2 echo "Example to download v0.7.2:" | |
>&2 echo "" | |
>&2 echo ' $' "`basename $0` 7.2" | |
>&2 echo "" | |
>&2 echo "Example to download latest version:" |
View signal.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <functional> | |
template<typename... ArgsT> | |
struct EventHook; | |
template<typename... ArgsT> |
View automagic.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Conditionally enable a function if they share the same CurveT type | |
/// e.g. template<IsSameCurve<CurveT,OtherType> = 0> | |
template<typename MyCurve, typename OtherType> | |
using IsSameCurve = std::enable_if_t<std::is_same<MyCurve,typename OtherType::CurveT>::value,int>; | |
/// Conditionally enable a function if the are of the same types and curves | |
/// Uses CanonicalSelfT to determine if they're the same general type | |
/// e.g. template<IsSameCurve<CurveT,OtherType> = 0> |
View text2sms.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def text2sms(text): | |
pairs = [' ', '!', 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz'] | |
mapping = {c:(str(i)*(j+1)) for i,p in enumerate(pairs) for j, c in enumerate(p)} | |
return '-'.join(mapping[c] for c in text if c in mapping) |
View tal.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
from pypeg2 import word, attr, maybe_some, blank, endl, parse, optional | |
from collections import defaultdict | |
class ExprBase(str): | |
pass | |
class Expression(ExprBase): | |
def __str__(self): | |
return str(self.inside) + ''.join([str(_) for _ in self.rhs]) |
NewerOlder