Skip to content

Instantly share code, notes, and snippets.

View lsankar4033's full-sized avatar
🎯
Focusing

Lakshman Sankar lsankar4033

🎯
Focusing
View GitHub Profile
private def toNum(c: Char): Int = c match {
case 'X' => 10
case ci if c.isDigit => c.toInt
case _ => throw new IllegalStateException("Can't get here")
}
def validate(s: String): Boolean = {
val validChars = s.filter(c => c.isDigit || c == 'X')
if (validChars.length != 10) {
false
@lsankar4033
lsankar4033 / BirthdayCoin.sol
Last active March 6, 2018 21:20
etherdate contract
pragma solidity ^0.4.4;
contract BirthdayCoin {
uint constant startingPrice = 20 finney;
string constant startingMessage = "Nothing to see here...";
// There are 366 coins (1-indexed so that 0 can be used as a non-assignment flag):
// day | id
// 1/1 | 1
// ...
@lsankar4033
lsankar4033 / abi.json
Created March 18, 2018 23:22
Etherdate
"abi": [
{
"constant": true,
"inputs": [],
"name": "creator",
"outputs": [
{
"name": "",
"type": "address"
}
@lsankar4033
lsankar4033 / Etherdate.sol
Last active March 19, 2018 12:21
Etherdate gen 2
pragma solidity ^0.4.4;
contract Etherdate {
uint constant startingPrice = 20 finney;
string constant startingMessage = "Nothing to see here...";
uint constant dummyCoinID = 0;
// There are 366 coins (1-indexed so that 0 can be used as a non-assignment flag):
// day | id

Keybase proof

I hereby claim:

  • I am lsankar4033 on github.
  • I am ls43 (https://keybase.io/ls43) on keybase.
  • I have a public key ASDYr7tC5YMqUXWROkkuuitOqBfDnh2sLwRsgtpScdq2xwo

To claim this, I am signing this object:

@lsankar4033
lsankar4033 / attestation.txt
Created September 3, 2021 03:14
Attestation
I contributed to the clr.fund Trusted Setup Multi-Party Ceremony.
The following are my contribution signatures:
Circuit: qvt32
Contributor # 45
Hash: 9db23202 bdb5fc8c f4579ac8 d90110d2
d1f77587 8575f9f5 c2e3c531 953814e1
2a69134c 27459d0f 5499e8de ac6f732e
36db1c64 59662896 82ccfa39 f8288f9b
import { buildPoseidon } from 'circomlibjs';
const poseidon = await buildPoseidon();
const F = poseidon.F; // poseidon finite field
// NOTE: picked this as the null field element because it's known to not be in the tree
const NULL_NODE = 1;
async function buildTree(leaves) {
leaves.sort();
@lsankar4033
lsankar4033 / Exit.sol
Last active September 9, 2022 08:09
0x03 withdrawal contract pseudocode
contract Exit {
event Exited(address withdrawer, bytes val_pubkey);
constructor() {}
function exit(bytes val_pubkey) {
emit Exited(msg.sender, val_pubkey);
}
}