createPool(tokenA, tokenB) deploys one GIWASwapPool and stores both orderings in getPool[a][b] and getPool[b][a]. The factory enforces: tokenA ≠ tokenB, both non-zero addresses, and no duplicate pair. Canonical ordering is token0 < token1 by address.
Pool: GIWASwapPool (GLP) — The Pool is itself an ERC-20 LP token ("GLP") whose total supply represents pro-rata ownership of the reserves. State: reserve0 and reserve1. Every action (swap, mint, burn) re-syncs reserves from actual balances and emits the corresponding event. Reserves can never silently drift from balances.
DojangScore.feeBpsFor(swapper) at swap time. Verified wallets pay less; bots pay the base rate.| Tier | Basis points | Swap fee % | Condition |
|---|---|---|---|
| PlatinumPlatinum | 10 bps | 0.10 % | DojangScore ≥ 800 |
| GoldGold | 15 bps | 0.15 % | Score 500 – 799 |
| SilverSilver | 20 bps | 0.20 % | Score 200 – 499 |
| StandardUnverified | 30 bps | 0.30 % | Score < 200 |
The tiered-fee mechanism requires DojangScore and the Upbit attester, which exist only on GIWA. There is no address to call on Ethereum mainnet, Arbitrum, or any other chain — the attestation infrastructure is chain-local and Dunamu-specific.
Combined with GIWA's ~200ms Flashblocks, the swap UX is faster and cheaper for verified wallets than any existing DEX offering. A Platinum user paying 0.10% on GIWA Sepolia is paying less than any Uniswap v3 pool (lowest: 0.01%, but only for stablecoin pairs and with no trust discount).
GIWASwap's strategic role is threefold: foundational liquidity + price discovery for the GIWA ecosystem's assets, a verification flywheel (every swap incentivizes KYC so the next one is cheaper), and fee revenue for the protocol. It is not a DEX-for-its-own-sake.
feeTo mechanism). Default: off. When on, the LP keeps 5/6 and protocol treasury takes 1/6.The pool's own reserves are the canonical price. This means the pool cannot be manipulated by an external oracle failure, but any external UI, router, or strategy that displays or acts on the pool's price must use a TWAP (e.g. accumulated price over N blocks), not the spot reserve ratio. Spot quotes are manipulable within a single block via flash loans — using them as triggers for external logic is a known attack vector.
The sqrt(x·y) − 1000 first-mint formula permanently locks 1000 GLP wei to address(0). This means total supply is always ≥ 1000 after the first deposit, preventing a full drain back to zero shares and the accompanying reserve-ratio manipulation. Recommended seeding: operator bootstraps with a balanced initial position before opening to public LPs.
A wrong DojangScore sets the wrong fee tier for a swap. This means a verified user might pay Unverified rates, or vice versa. This is a pricing error, not an AMM correctness error. The constant-product invariant still holds; amountOut is still correctly computed for whatever fee bps is returned. The trust discount is a perk, not a safety property. The pool settles correctly regardless.
The current implementation trusts that transfer / transferFrom behave as standard ERC-20: no fee-on-transfer, no rebasing, no reentrancy in the token hook. Malicious or non-standard tokens can break the reserve integrity invariant silently. Roadmap: an allowlist of approved token addresses + safeTransfer wrappers + post-transfer balance checks. The demo pairs (TKRW / TUSD) are our own MockERC20 instances with no surprises.
Every action recomputes reserves from balanceOf(address(this)) after the transfer, not from a stored accumulator. This means reserves can never drift from actual balances due to direct token sends. It is the same discipline that caught the vault's 1e21 share price: the dashboard that must never lie is a security control, not decoration. If the pool holds what the state says, any inconsistency surfaces immediately.