Skip to content

Instantly share code, notes, and snippets.

View sunce86's full-sized avatar

Dusan Stanivukovic sunce86

View GitHub Profile
CLI
Version 3.76.0
Go Version go1.20.6
Go Compiler gc
Plugins
NAME VERSION
nodejs unknown
Host
2024-04-16T17:32:54.179Z INFO request{id="5892798238db6df414f34dc7430c414d"}:/quote{solver=quasilabs-quote-native}: driver::infra::observe: computed solutions solutions=[Solution { id: Single(0), trades: [Fulfillment(Fulfillment { order: Order { uid: Uid(0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000), receiver: None, valid_to: Timestamp(4294967295), buy: Asset { amount: TokenAmount(1), token: TokenAddress(ContractAddress(0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48)) }, sell: Asset { amount: TokenAmount(400000000000000000), token: TokenAddress(ContractAddress(0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2)) }, side: Sell, kind: Limit, app_data: AppData(0x0000000000000000000000000000000000000000000000000000000000000000), partial: No, pre_interactions: [], post_interactions: [], sell_token_balance: Erc20, buy_token_balance: Erc20, signature: Signature { scheme: Eip1271, data: 0x, signer: Address(0x0000000000000000000000000000000000000000) }, protoc
BEGIN;
INSERT INTO trades (
block_number,
log_index,
order_uid,
sell_amount,
buy_amount,
fee_amount
) VALUES (
INSERT INTO order_quotes (order_uid, gas_amount, gas_price, sell_token_price, sell_amount, buy_amount, solver)
SELECT
o.uid,
1.0 AS gas_amount,
1.0 AS gas_price,
1.0 AS sell_token_price,
o.sell_amount AS sell_amount,
o.buy_amount AS buy_amount,
'\x0000000000000000000000000000000000000000' AS solver
FROM
INSERT INTO order_quotes (order_uid, gas_amount, gas_price, sell_token_price, sell_amount, buy_amount, solver)
SELECT
o.uid,
0.0 AS gas_amount,
0.0 AS gas_price,
1.0 AS sell_token_price,
0 AS sell_amount,
0 AS buy_amount,
'0' AS solver
FROM
// tx hash 0x201c948ad94d7f93ad2d3c13fa4b6bbd4270533fbfedcb8be60e68c8e709d2b6
// solver competition endpoint values;
// "solver": "ParaSwap",
// "objective": {
// "total": 251547381429604400,
// "surplus": 237248548166961920,
// "fees": 45972570277472210,
// "cost": 31673737014829776,
// "gas": 765096
// },
let mut db = PgConnection::connect("postgresql://").await.unwrap();
let mut db = db.begin().await.unwrap();
// insert execution_order
let order = OrderUid::from_str("0x7c7632ff155758bed7b7b2834a38f07c034c0e009db4e2916e3a70dd1140ba1789e4042fd85e857e81a4fa89831b1f5ad4f384b763ff5c07").unwrap();
database::order_execution::save(&mut db, &ByteArray(order.0), 7000454, 43.7075167431769, None).await.unwrap();
// insert auction_transaction
let tx_from = H160::from_str("0xe33062a24149f7801a48b2675ed5111d3278f0f5").unwrap();
database::auction_transaction::upsert_auction_transaction(&mut db, 7000454, &ByteArray(tx_from.0), 3887).await.unwrap();
type EncodedSettlementTokenized = (
Vec<Address>,
Vec<U256>,
Vec<(
U256, // sellTokenIndex
U256, // buyTokenIndex
Address, // receiver
U256, // sellAmount
U256, // buyAmount
u32, // validTo
type EncodedSettlementTokenized = (
Vec<Address>,
Vec<U256>,
Vec<(
U256, // sellTokenIndex
U256, // buyTokenIndex
Address, // receiver
U256, // sellAmount
U256, // buyAmount
u32, // validTo
### Keybase proof
I hereby claim:
* I am sunce86 on github.
* I am sunce86 (https://keybase.io/sunce86) on keybase.
* I have a public key ASCk6ZTRQavGxyajmGP_JWvNF-sOCXo1k2TZR-D4ppKVTwo
To claim this, I am signing this object: