Skip to content

Instantly share code, notes, and snippets.

View SuperCipher's full-sized avatar
💭
GMT+7 08:00 - 22:00

Napat SuperCipher

💭
GMT+7 08:00 - 22:00
  • BiggestFan Production
  • Thailand
View GitHub Profile
@SuperCipher
SuperCipher / gist:74be44777226f3465ec1bb66edfd06c8
Created March 21, 2022 16:11
recursive signature signing
SELLER_INFO_TYPE_HASH: constant(bytes32) = keccak256("SellerERC721Addresses(address addr)SellerInfo(address addr,address erc20_address,seller_erc721_addresses SellerERC721Addresses)")
# SELLER_INFO_TYPE_HASH: constant(bytes32) = keccak256("SellerInfo(address addr,address erc20_address)")
SELLER_ERC721_ADDRESSES_TYPE_HASH: constant(bytes32) = keccak256("SellerERC721Addresses(address addr)")
@external
def checkSellerSignature(_sellers_signing_account:address, _signature: Bytes[65], _seller_address: address, _seller_ERC20_address: address, _seller_info: Seller_Info) -> bytes32:
assert _seller_address != ZERO_ADDRESS, "invalid _seller_address"
assert _seller_ERC20_address != ZERO_ADDRESS, "invalid _seller_ERC20_address"
assert _seller_info.erc721_addresses[0].nft_address == 0x0FD4C4Ef9Bbe66217Eb790E5D42A5cC103eeFC90
assert _seller_info.erc721_addresses[0].price == 5
@SuperCipher
SuperCipher / gist:8b470edc7a987aa765969a84d6e20430
Last active February 6, 2022 12:56
Unable to print in pytest and tox [FIXED]
Answer inspired from.
https://stackoverflow.com/a/58486539/3422861
My issue cause multiple pytest config and one that cause pytest to run in parallel.
https://github.com/vyperlang/vyper/blob/master/setup.cfg#L28
https://github.com/vyperlang/vyper/blob/82f44eea2c7be79c6db805c1aa873fabbe0118b7/setup.cfg#L28
remove -n auto flag option or remove any flag that will cause pytest to run in parallel.
@SuperCipher
SuperCipher / truffle.js
Created January 6, 2022 13:23
truffle config network
rinkeby: {
provider: function () {
return new HDWalletProvider(MNEMONIC, rinkebyNodeUrl);
},
gas: 5000000,
network_id: 4,
},
@SuperCipher
SuperCipher / smartbchseed
Created December 23, 2021 09:18
smartbch seed
f2e96f418033a615eefddd267df7010fc14700c9@13.212.74.236:26656
b94a1ce42f7504ee6825252308a65e5ddbed041b@175.41.170.82:26656
f443c07711e5da5b82e76fd567ececbac1a74d39@54.169.207.96:26656
b4eb02fb78e9b76a3ed148e764229abd8b766516@35.209.224.243:26656
9553b9f605b5da8b04b2c5a5768242dd84b57a94@35.209.93.74:26656
(py385) ~/dev/sandbox-af/SmartBCHhealthCheck ⮀ main● ⮀ 4h49m ⮀ curl 'https://smartbch.greyh.at/mainnet' -X POST -H 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"tm_nodeInfo","params":[],"id":1}'
{"jsonrpc":"2.0","id":1,"result":{"is_validator":false,"validator_index":0,"height":1920280,"seed":"b4eb02fb78e9b76a3ed148e764229abd8b766516@0.0.0.0:26656","consensus_pub_key":"cA+f3YBN4oFdcsoBIefrfNICWfSI72HJ14vvg34ibL0=","app_state":{"validators":[{"address":"0x9a6dd2f7ceb71788de691844d16b6b6852f07aa3","pubkey":"0xfbdc5c690ab36319d6a68ed50407a61d95d0ec6a6e9225a0c40d17bd8358010e","reward_to":"0x9a6dd2f7ceb71788de691844d16b6b6852f07aa3","voting_power":10,"introduction":"matrixport","staked_coins":"0x0000000000000000000000000000000000000000000000000000000000000000","is_retiring":false},{"address":"0x7dd41d92235cbbe0d2fe4ebd548cdd29f9befe5e","pubkey":"0x45caa8b683a1838f6cf8c3de60ef826ceaac27351843bc9f8c84cedb7da9a8a0","reward_to":"0x7dd41d92235cbbe0d2fe4ebd548cdd29f9befe5e","voting_power":1,"intro
@SuperCipher
SuperCipher / curl-eth-json-rpc.md
Last active January 25, 2022 05:59
Eth JSON RPC status

Get current block:

curl '172.21.0.3:8545' -X POST -H 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":83}'

result

 { "id":83, "jsonrpc": "2.0", "result": "0x4b7"  }

or

@SuperCipher
SuperCipher / mangoDecodeRate.ts
Created November 18, 2021 14:56
mango rate decode
import {
blob,
Blob,
greedy,
Layout,
nu64,
seq,
struct,
Structure,
u16,
@SuperCipher
SuperCipher / Solana JSON RPC
Created November 16, 2021 16:06
Solana JSON RPC
curl https://mango.devnet.rpcpool.com -X POST -H "Content-Type: application/json" -d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getAccountInfo",
"params": [
"8mFQbdXsFXt3R3cu3oSNS3bDZRwJRP18vyzd9J278J9z",
{
"encoding": "base64"
}
@SuperCipher
SuperCipher / instagram-compact-style.css
Created September 19, 2021 11:29
instagram css style rewrite (compact short scroll)
/*use with custome style script extension*/
._8Rm4L, .AcVnq {
margin-bottom: 0px;
}
.Ppjfr{
height: 40px
}
.MEAGs{
height: 40px
@SuperCipher
SuperCipher / deployment.yml
Created September 15, 2021 14:47 — forked from troyharvey/deployment.yml
Using Kubernetes envFrom for environment variables
# Use envFrom to load Secrets and ConfigMaps into environment variables
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: mans-not-hot
labels:
app: mans-not-hot
spec:
replicas: 1