Skip to content

Instantly share code, notes, and snippets.

View swapnilraj's full-sized avatar

Swapnil Raj swapnilraj

View GitHub Profile
@swapnilraj
swapnilraj / addmod_mulmod.sol
Last active January 19, 2022 17:57
Solidity Semantic Tests
contract C {
function test() public returns (uint256) {
// Note that this only works because computation on literals is done using
// unbounded integers.
if ((2**255 + 2**255) % 7 != addmod(2**255, 2**255, 7)) return 1;
if ((2**255 + 2**255) % 7 != addmod(2**255, 2**255, 7)) return 2;
return 0;
}
}
contract test {
function f(bool cond) public returns (uint) {
uint8 x = 0xcd;
uint16 y = 0xabab;
return cond ? x : y;
}
}
// ====
// compileToEwasm: also
// compileViaYul: also
%lang starknet
from starkware.cairo.common.alloc import alloc
from starkware.cairo.common.cairo_builtins import BitwiseBuiltin
from starkware.cairo.common.cairo_keccak.keccak import keccak_uint256s, finalize_keccak, keccak_uint256s_bigend
rom starkware.cairo.common.math import split_felt
from starkware.cairo.common.math_cmp import is_le_felt
from starkware.cairo.common.uint256 import Uint256, uint256_shl, uint256_add
func felt_to_uint256{range_check_ptr}(x) -> (x_ : Uint256):
@swapnilraj
swapnilraj / accepted_eip_authorship_report.txt
Created May 8, 2025 21:40
Results from data analysis of EIP repos
Accepted EIP Authorship by Organization
=======================================
Generated: 2025-05-08 22:27:51
Total entities: 75
Total share: 1.00
Top entities by share:
Rank | Organization | Share | Cumulative | Bar