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
  • Thailand
View GitHub Profile
(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 / 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
@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 / 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 / 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:8095fde9d52ac8d13d38eb0364558006
Created March 21, 2022 16:13
signing recursive data structure EIP-712
def sign_seller_signature():
def sign_seller_signature(
contract,
sellers_signing_account: Account, # NOTE: Must be a eth_key account, not Brownie
seller_address,
seller_erc20_address,
seller_info,
):
name = "Ampleia"
version = contract.apiVersion()
E brownie.exceptions.VirtualMachineError: revert: dev: invalid _signature
E Trace step 619, program counter 4422:
E File "contracts/exchange_presale.vy", line 204, in exchange_presale.checkSellerSignature:
E v: uint256 = convert(slice(_signature, 64, 1), uint256)
E assert ecrecover(digest, v, r, s) == _sellers_signing_account # dev: invalid _signature
E return digest
tests/test_exchange_presale.py:309: VirtualMachineError
{"chain_id": 80001, "node_rpc": "https://polygon-mumbai.infura.io/v3/529aa367cbba407a98c67577f8b986a0", "Wallets": {"exchange": {"address": "0x94Ac3ed3b60C3262EFD35498D98b39402B317912", "private": "a9c2d97ebaee358471cc487b1d7af7ce12256789f47af3d17fc1fb598031ee4e"}, "seller": {"address": "0xe00BCef53DD14AE43963cfdd824e78c1858Ea3a8", "private": "76d4921b8eebb1ab031a0296427262e12aef3989132e9cd77d1f4272350bb06f"}, "erc20_owner": {"address": "0x7A51BA6C12AF5010FE596Ad5496823C1d96E7DD9", "private": "6ee576c44b0c9aecdcdcdbb5260fc3dde3403f67b1083253d4d902540ad32335"}}, "erc20": {"address": "0x32B00de4829aAD186e0eD0DC9c0f0c5520285A69", "tx": "0x898d7980d3104b2bd7b99815a5fd6aa86ad189e7c8f6ad6bc43e146568d734a9", "block_number": 25712224, "block_hash": "0x479b260da79ee939d52806a424e9fad589e220b264175d5c81a5b54d39854d34", "total_supply": 10000, "decimals": 18, "name": "Ampleia Coin", "symbol": "A14", "abi": [{"anonymous": false, "inputs": [{"indexed": true, "name": "sender", "type": "address"}, {"indexed": true, "name": "
@SuperCipher
SuperCipher / gist:38f584b25b211465bbb72e3409013435
Last active April 5, 2022 09:38
exchange 0.0.2 integrate test
{"chain_id": 80001, "node_rpc": "https://polygon-mumbai.infura.io/v3/529aa367cbba407a98c67577f8b986a0", "Wallets": {"exchange": {"address": "0x7A51BA6C12AF5010FE596Ad5496823C1d96E7DD9"}, "seller": {"address": "0xe00BCef53DD14AE43963cfdd824e78c1858Ea3a8"}}, "exchange_contract": {"abi": [{"inputs": [], "name": "apiVersion", "outputs": [{"name": "", "type": "string"}], "stateMutability": "pure", "type": "function"}, {"inputs": [{"name": "_contract_owner", "type": "address"}, {"name": "_platform_signing_account", "type": "address"}, {"name": "_seller_eoa", "type": "address"}], "outputs": [], "stateMutability": "nonpayable", "type": "constructor", "name": "constructor"}, {"inputs": [{"name": "_platform_signature", "type": "bytes"}, {"name": "_buyer_address", "type": "address"}, {"components": [{"name": "seller_eoa", "type": "address"}, {"name": "sale_currency", "type": "address"}, {"name": "erc721_addresses", "type": "(address,uint256,uint256)[3]"}, {"name": "collection_start_time", "type": "uint256"}, {"name": "c
@SuperCipher
SuperCipher / gist:d338653374381dbf620954b5502bc590
Last active April 5, 2022 10:05
deploy NFT integrate test
{"chain_id": 80001, "node_rpc": "https://polygon-mumbai.infura.io/v3/529aa367cbba407a98c67577f8b986a0", "Wallets": {"seller": {"address": "0xe00BCef53DD14AE43963cfdd824e78c1858Ea3a8", "private": "76d4921b8eebb1ab031a0296427262e12aef3989132e9cd77d1f4272350bb06f"}}, "erc721": {"SILVER": {"address": "0xaF27c6628135833e3bf094478829D498746A93D4", "tx": "0xf76689b73ce659068dd8f954093184c8440b6249ccee9d023547e1bcbb0a6a4e", "block_number": 25809044, "block_hash": "0xb84b2281f2af8ce1aebb51f6b57314fa085938a7d33ead6d1c8e918c2cde2f17", "name": "Silver box", "symbol": "SILVER", "total_supply": 0, "max_supply": 50000, "abi": [{"anonymous": false, "inputs": [{"indexed": true, "name": "sender", "type": "address"}, {"indexed": true, "name": "receiver", "type": "address"}, {"indexed": true, "name": "tokenId", "type": "uint256"}], "name": "Transfer", "type": "event"}, {"anonymous": false, "inputs": [{"indexed": true, "name": "owner", "type": "address"}, {"indexed": true, "name": "approved", "type": "address"}, {"indexed": true,