← Back
Gild-org

Gild-org/gild-contract

View on GitHub ↗
Stars
114
Forks
313
Watchers
114
Open issues
0
Contributors
1
Language
Solidity
License
—
Default branch
main
Created Sep 30, 2026Updated Oct 1, 2026

Star growth

Today—
This week—
This month—

Star history will appear here once this repo has been tracked for a couple of days.

README

Gild contracts

Foundry project for Gild on BNB Smart Chain: DammHook, GildRouter, fee collector, and banded buyback. The Next.js app lives in the sibling folder gild-app.

This code is unaudited. Do not route production size until the Four.meme selectors are checked against the verified BscScan ABI and an independent review is done. Infinity Bin is not shipped.

Layout

  • src Solidity sources
  • test Foundry tests, including the Four.meme mock
  • script Deploy.s.sol and SeedPool.s.sol
  • config/addresses.json canonical Pancake and WBNB addresses
  • TOKENOMICS.md Flap-launched GILD and the fee burn path

Install

curl -L https://foundry.paradigm.xyz | bash
foundryup
forge install

forge install pulls forge-std and OpenZeppelin into lib. Those directories are gitignored. The Infinity types under lib/infinity-core are a layout-compatible excerpt so the hook matches ICLHooks without compiling Pancake's AMM. See lib/infinity-core/NOTICE.md.

Test

forge test

Hook permissions

Pancake Infinity does not mine permission bits into the hook address. getHooksRegistrationBitmap() is copied into PoolKey.parameters (low 16 bits). Tick spacing occupies bits 16–39. script/SeedPool.s.sol sets tick spacing 10 that way.

A CREATE2 vanity salt is optional and does not change permissions. Do not port Uniswap v4 address flags onto this hook.

Deploy

Fill .env from .env.example. Never commit PRIVATE_KEY.

forge script script/Deploy.s.sol --rpc-url "$BSC_TESTNET_RPC" --broadcast

Set GILD_TOKEN to the Flap launch address before running the script. The script does not deploy a token and does not mint. Buyback is constructed with that address. On chain id 56 the token must already be a Flap curve token (status 1) or a graduated Flap token (status 4); the script then calls syncFlap so the registry follows the portal. Chain id 97 uses the Infinity testnet manager and vault from config/addresses.json. Chain id 56 uses mainnet. The script deploys config, fee collector, buyback, hook, registry, adapter, router, and quoter, then proposes a 2-day TimelockController as the next config owner. The timelock must call acceptOwnership. Seed liquidity before that acceptance:

forge script script/SeedPool.s.sol --rpc-url "$BSC_RPC" --broadcast

The Pancake V2 router in config is 0x10ED43C718714eb63d5aA57B78B54704E256024E. That is the deployed router.

Four.meme and Flap

IFourMeme follows Four.meme's published TokenManager2 and Helper3 notes dated 2025-10-30:

  • TokenManager2 0x5c952063c7fc8610FFDB798152D69F0B9550762b
  • Helper3 0xF251F83e40a78868FcfA3FA4599Dad6494E46034

Replace those interfaces if BscScan verification disagrees. Tests use MockFourMeme.

Flap uses the portal at 0xe2cE6ab80874Fa9Fa2aAE65D277Dd6B8e65C9De0. IFlap matches the swapExactInput and getTokenV8Safe fragments already used by the app. Deploy.s.sol calls setPortal on mainnet. FeeCollector.forwardToBuyback sends swept WBNB to the buyback contract.