0x…apus (@dev_apus) header
0x…apus (@dev_apus) profile picture

A crypto developer and defi specialist. Founder of @apusindustries . Builder of @supacore_xyz and @supadaofi

Blockchain
Joined June 2018
Offset pagination has a quiet bug. You load 20 rows. A new one arrives. Page 2 skips 20 and starts one row early, so the last row of page 1 shows up again. A cursor fixes it. Ask for "rows after this one", not "skip 20".
16
Never rename a column in one deploy. During a rollout, old and new code can run side by side on the same database. One of them will look for a column that isn't there. Add first. Switch. Remove later.
19
"14:00" without a time zone is not a time. It's a guess. Store timestamps in UTC. Convert to local time only at the edges: when someone types it in, and when someone reads it. Sorting, comparing and lining up logs all get easier when everything shares one clock.
15
is_paid, is_failed, is_refunded. Three booleans, eight combinations, most of them nonsense (paid and failed?). Use one status field and list the allowed moves: created → submitted → settled → refunded submitted → failed Reject everything else at write time.
3
39
I merged Phase 0b of SupaCore to main yesterday: a composed payment flow with rail dispatch, in the Go backend I'm building. Pre-production proof of concept, not a live system. For people building in payments and interoperability: @Mastercard @keoneHD @bgarlinghouse
1
2
55
Don't UPDATE a balance. INSERT an entry. Store each movement as an append-only entry; the balance is their sum. You get an audit trail, no lost updates from racing writes, and fixes as reversing entries. Cache the balance for speed, but don't treat the cache as the truth.
2
23
Unit tests check the examples you thought of. Invariant tests check a promise: something that must hold after any sequence of calls. Write the promise in one plain sentence, then let a fuzzer try to break it. If you can't state it, you don't understand the design yet.
1
4
34
An external call hands over control. When your contract sends ETH or calls another contract, that code runs before your function finishes, and it can call you back. So finish your own bookkeeping first: check, update state, then call out.
3
41
Integer maths means every division rounds somewhere. The real question is who the rounding favours. In a vault or pool, round against the caller: down on what they receive, up on what they pay. ERC-4626 spells this out. Round the other way and enough tiny calls can leak value.
3
41
Less duplicated infrastructure is not the same as less complexity. Shared systems need stronger boundaries, especially while the design is still being proved.
3
I would rather be precise about the stage than sound further along than the work is. A testnet is a place to learn. It is not a launch.
1
5