Skip to content

Instantly share code, notes, and snippets.

View Luke-Rogerson's full-sized avatar

Luke Rogerson Luke-Rogerson

View GitHub Profile
@Luke-Rogerson
Luke-Rogerson / create_order.json
Created January 25, 2024 13:03
create_order_body
{
"price": "0.86500000",
"size": "40",
"symbol": "MATIC-USDC",
"side": "sell",
"clientOrderId": "550e8400-e29b-41d4-a716-446655440000",
"eip712Sig": "0xc83cacc200812f9f62f643f3ff6e3ce5474c05d440ae8149097596db632ede033179ca2ee150cdc17a146697ac43c08eacd1e7faf2ec1dacebbc837823ea5f791c",
"eip712Domain": {
"name": "RePermit",
"chainId": "137",
@Luke-Rogerson
Luke-Rogerson / encode.py
Last active January 23, 2024 16:42
Partial order encoding
from eth_abi import encode
# Define the data types as strings
order_info_type = "(address,address,uint256,uint256,address,bytes)"
partial_input_type = "(address,uint256)"
partial_output_type = "(address,uint256,address)"
partial_order_type = "(tuple,address,uint256,tuple,tuple[])"
# Define the data structure with correct types
partial_order_abi = [
@Luke-Rogerson
Luke-Rogerson / eip712.json
Created January 22, 2024 15:38
eip712.json
{
"domain_separator":{
"chainId":"137",
"name":"RePermit",
"verifyingContract":"0x4d415B58EA43988FfF7f50A3475718b0858fE0f1"
},
"message_types":{
"OrderInfo":[
{
"name":"reactor",
@Luke-Rogerson
Luke-Rogerson / pairs.go
Last active November 29, 2023 15:23
Token pair/symbol parsing
package main
import (
"fmt"
"strings"
)
type TokenPair struct {
InToken string
OutToken string
@Luke-Rogerson
Luke-Rogerson / docker-compose.yml
Created October 20, 2023 20:29
docker-compose.yml for docker compose watch example
version: "3.8"
services:
app:
build:
dockerfile: Dockerfile
context: .
develop:
watch:
- action: rebuild
files:
@Luke-Rogerson
Luke-Rogerson / Dockerfile
Created October 20, 2023 20:25
Dockerfile for docker compose watch example
FROM golang:1.21.3
WORKDIR /app
COPY . .
RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux go build -o main .
@Luke-Rogerson
Luke-Rogerson / traverse.go
Last active October 17, 2023 15:41
GetMinMaxPriceOrder, GetNextOrder
package redisrepo
import (
"context"
"github.com/google/uuid"
"github.com/orbs-network/order-book/models"
)
type OrderTraversal interface {
@Luke-Rogerson
Luke-Rogerson / typedmessage.ts
Created October 4, 2023 14:09
signTypedData MessageTypes
export interface MessageTypes {
EIP712Domain: MessageTypeProperty[];
[additionalProperties: string]: MessageTypeProperty[];
}
/**
* This is the message format used for `signTypeData`, for all versions
* except `V1`.
*
* @template T - The custom types used by this message.
* @property types - The custom types used by this message.
/**
* @dev Taken from OpenZeppelin Contracts (access/Ownable.sol).
* Represents the project owner entity of a given project.
* Names have been changed, but otherwise the code is identical.
*/
abstract contract ProjectRole is Context {
address private _projectOwner;
event ProjectOwnershipTransferred(address indexed previousProjectOwner, address indexed newProjectOwner);
logger = use_logging()
logger.info('An informative log message', extra={'user_id': 'abc123', **function_args})