개발자 연동
봇, 터미널, 애그리게이터, 지갑을 위한 컨트랙트, 거래 호출, 인덱싱할 이벤트 안내.
GIWA Sepolia·지금 테스트넷에서 토큰을 발행해 보세요. Gamapad는 GIWA 메인넷 Day 1부터 바로 오픈해요.
테스트 ETH 받기ETH 브리지봇, 터미널, 애그리게이터, 지갑을 위한 컨트랙트, 거래 호출, 인덱싱할 이벤트 안내.
Gamapad의 모든 동작은 GIWA Sepolia 온체인에서 일어나요. 그래서 봇, 터미널, 지갑은 API 키 없이 컨트랙트에 바로 연동할 수 있어요. 모든 컨트랙트는 탐색기에서 검증되어 있으니, ABI는 그곳의 검증된 소스에서 가져오세요.
토큰. 모든 토큰은 소수점 18자리, 고정 발행량 1,000,000,000개의 일반 ERC-20이에요. 발행량은 한 번만 민팅되어 각 토큰의 본딩 커브로 가요. 소유자도 특별한 권한도 없어요.
GIWA Sepolia의 실시간 값이에요. 현재 배포 정보에서 읽어 오기 때문에 앱이 쓰는 네트워크와 항상 같아요.
91342https://sepolia-rpc.giwa.ioexport RPC=https://sepolia-rpc.giwa.io각 토큰의 커브는 phase()로 현재 단계를 알려 줘요.
phase() | 단계 | 할 수 있는 일 |
|---|---|---|
0 | 커브 거래 중 | 커브에서 사고팔 수 있어요. |
1 | 졸업 대기 | 커브가 가득 찼어요. 매수는 막히고 매도는 그대로 되며, 누구나 graduate()를 호출해 이동을 마칠 수 있어요. |
2 | 졸업 완료 | 커브는 닫혔어요. v4 풀에서 거래하세요. |
졸업은 보통 커브를 채우는 매수 안에서 함께 일어나서, 대부분의 토큰은 한 트랜잭션 만에 0에서 2로 넘어가요. 1단계는 그 과정이 끝나지 못했을 때만 보여요.
팩토리는 토큰마다 한 번, 출시 트랜잭션에서 LaunchCreated를 내보내요.
event LaunchCreated(address indexed token, address indexed curve, address indexed creator, address feeRecipient,
bytes32 metadataHash, bytes32 economicsHash, uint16 creatorTaxBps, uint16 protocolShareBps,
uint256 virtualEth, uint256 graduationEth);지난 출시를 채우거나 주기적으로 확인하려면 launchCount()와 launches(i)(출시 순서대로의 토큰 주소)를 읽고, 토큰의 커브는 curveOf(token)으로 찾으세요. 팩토리는 37509213 블록에 배포되었으니 로그 스캔은 거기서 시작하면 돼요.
N=$(cast call 0xa06afA279a704960e7bFc17d5113a2283dD4E7d4 "launchCount()(uint256)" --rpc-url $RPC | head -n1 | cut -d' ' -f1)
TOKEN=$(cast call 0xa06afA279a704960e7bFc17d5113a2283dD4E7d4 "launches(uint256)(address)" $((N - 1)) --rpc-url $RPC)
cast call 0xa06afA279a704960e7bFc17d5113a2283dD4E7d4 "curveOf(address)(address)" $TOKEN --rpc-url $RPC졸업 전에는 모든 토큰이 자기 커브를 상대로 네이티브 ETH로 거래돼요. 모든 호출은 curveOf(token)이 돌려주는 커브 주소로 보내요.
function quoteBuy(uint256 ethIn, bool allowPartialFill) view
returns (uint256 tokensOut, uint256 spentWei, uint256 refundWei, uint256 totalFeeWei);
function buy(uint256 minTokensOut, uint256 deadline, bool allowPartialFill,
uint256 minFillTokensPerEthWad, uint16 maxTotalFeeBps) payable
returns (uint256 tokensOut, uint256 spentWei, uint256 refundWei);
function quoteSell(uint256 tokenIn) view returns (uint256 ethOut, uint256 totalFeeWei);
function sell(uint256 tokenAmount, uint256 minEthOut, uint256 deadline, uint16 maxTotalFeeBps)
returns (uint256 ethOut);
function phase() view returns (uint8);
function creatorTaxBps() view returns (uint16);FeePolicy.baseFeeBps()(현재 100 bps, 1%)와 커브의 creatorTaxBps()를 내요. maxTotalFeeBps가 둘의 합보다 작으면 거래가 되돌려져서, 수수료가 바뀌어도 모르는 사이에 더 내는 일이 없어요.GIWA Sepolia에서는 졸업한 풀이 Gamapad 라우터를 거친 스왑만 받아요. 매수는 dexBuy, 매도는 dexSell로 하고, 둘 다 견적 컨트랙트의 quote로 견적을 받으세요. 표준 v4 라우터로 이 풀에서 거래하려면 이 네트워크에는 없는 Gamapad의 새 컨트랙트가 필요해요.
// GamaRouter 0x01E01B9d070262aD1D4B0a0D894556B4fE7A2e44
function dexBuy(address token, uint256 minTokensOut, uint256 deadline, uint16 maxTotalFeeBps,
uint24 expectedDexProtocolFee, uint160 sqrtPriceLimitX96) payable returns (uint256 tokensOut);
function dexSell(address token, uint256 tokenIn, uint256 minEthOut, uint256 deadline,
uint16 maxTotalFeeBps, uint24 expectedDexProtocolFee, uint160 sqrtPriceLimitX96) returns (uint256 ethOut);
// GamaQuoter 0x68329CB8eb090404026acc27E89d8FEbfdDef2af
function quote(address token, bool isBuy, uint256 amountIn) view
returns (uint256 amountOut, uint256 totalFeeWei, uint24 protocolFee, uint160 sqrtPriceAfterX96);sqrtPriceLimitX96에는 예시의 값을 넣으세요. 매수는 가장 낮은 가격, 매도는 가장 높은 가격이라 스왑이 중간에 끊기지 않아요. 보호는 최소 수량이 맡아요.사이트가 보여 주는 모든 정보는 다음 이벤트로 다시 만들 수 있어요.
| 이벤트 | 내보내는 곳 | 쓰임 |
|---|---|---|
LaunchCreated | LaunchFactory | 새 토큰과 그 커브, 크리에이터, 크리에이터 세금, 커브 설정 |
CurveTrade | 커브 | 커브의 모든 거래와 수수료, 거래 후 리저브: 가격, 시가총액, 졸업 진행률 |
Graduated | 커브 | 풀 ID와 풀에 들어간 ETH와 토큰 |
DexTrade | GamaHook | 풀의 모든 거래와 수수료예요. trader는 Gamapad 라우터이니 거래는 트랜잭션을 보낸 주소에게 귀속하세요. |
Transfer | 토큰 |
Gamapad 웹 API(/api/tokens 등)는 이 사이트를 위해 만든 거예요. 봇 차단 장치 뒤에 있어서 스크립트나 서버에서 보낸 요청은 막힐 수 있고, 예고 없이 바뀔 수 있어요. 대신 체인을 읽으세요. 이 페이지의 모든 정보는 공개되어 있어요.
토큰 목록이나 이미지처럼 HTTP 피드가 꼭 필요한 팀은 파트너 프로그램으로 신청하거나 X로 DM을 보내 주세요. 서버 IP를 허용해 드릴 수 있어요.
minTokensOut이나 minEthOut은 방금 받은 견적에서 내 슬리피지 허용치를 뺀 값으로 정하세요. deadline은 초 단위 Unix 타임스탬프예요.approve(curve, amount)를 호출한 뒤 sell을 호출하세요.allowPartialFill이 true가 아니면 되돌려져요. true면 커브가 채울 수 있는 만큼만 채우고 나머지는 환불하며, minFillTokensPerEthWad(0보다 커야 하고, ETH당 토큰 수에 1e18을 곱한 값)로 체결 비율의 하한을 정해요.GRADUATION_MIN_GAS). 마지막 즈음의 매수에는 2,000,000처럼 넉넉한 가스 한도를 주세요.Foundry의 cast로 쓴 예시예요. <CURVE>와 <TOKEN>은 토큰의 커브와 토큰 주소로, <YOUR_KEY_OR_ACCOUNT>는 내 cast wallet 계정으로 바꾸세요.
BASE=$(cast call 0x5E84dD21CB0db9bf60264c3aa546223F8C69Cccf "baseFeeBps()(uint16)" --rpc-url $RPC)
TAX=$(cast call <CURVE> "creatorTaxBps()(uint16)" --rpc-url $RPC)
CAP=$((BASE + TAX))ETH_IN=$(cast to-wei 0.01)
OUT=$(cast call <CURVE> "quoteBuy(uint256,bool)(uint256,uint256,uint256,uint256)" $ETH_IN false --rpc-url $RPC | head -n1 | cut -d' ' -f1)
MIN_OUT=$(echo "$OUT * 99 / 100" | bc)
cast send <CURVE> "buy(uint256,uint256,bool,uint256,uint16)" $MIN_OUT $(($(date +%s)+120)) false 0 $CAP \
--value $ETH_IN --gas-limit 2000000 --rpc-url $RPC --account <YOUR_KEY_OR_ACCOUNT>AMOUNT=$(cast to-wei 1000)
cast send <TOKEN> "approve(address,uint256)" <CURVE> $AMOUNT --rpc-url $RPC --account <YOUR_KEY_OR_ACCOUNT>
OUT=$(cast call <CURVE> "quoteSell(uint256)(uint256,uint256)" $AMOUNT --rpc-url $RPC | head -n1 | cut -d' ' -f1)
MIN_OUT=$(echo "$OUT * 99 / 100" | bc)
cast send <CURVE> "sell(uint256,uint256,uint256,uint16)" $AMOUNT $MIN_OUT $(($(date +%s)+120)) $CAP --rpc-url $RPC --account <YOUR_KEY_OR_ACCOUNT>트랜잭션 직후에 읽을 때
cast call … --block <n>) 잠시 후 다시 시도하세요.expectedDexProtocolFee에는 견적의 protocolFee를 넣으세요. 거래가 처리되기 전에 PoolManager의 프로토콜 수수료가 바뀌면 거래가 되돌려져요.maxTotalFeeBps는 커브에서와 똑같이 써요. dexSell 전에는 토큰에서 approve(router, amount)를 호출하세요.ETH_IN=$(cast to-wei 0.01)
Q=$(cast call 0x68329CB8eb090404026acc27E89d8FEbfdDef2af "quote(address,bool,uint256)(uint256,uint256,uint24,uint160)" <TOKEN> true $ETH_IN --rpc-url $RPC)
MIN_OUT=$(echo "$(echo "$Q" | sed -n 1p | cut -d' ' -f1) * 99 / 100" | bc)
PFEE=$(echo "$Q" | sed -n 3p | cut -d' ' -f1)
cast send 0x01E01B9d070262aD1D4B0a0D894556B4fE7A2e44 "dexBuy(address,uint256,uint256,uint16,uint24,uint160)" <TOKEN> $MIN_OUT $(($(date +%s)+120)) $CAP $PFEE 4295128740 \
--value $ETH_IN --rpc-url $RPC --account <YOUR_KEY_OR_ACCOUNT>
AMOUNT=$(cast to-wei 1000)
cast send <TOKEN> "approve(address,uint256)" 0x01E01B9d070262aD1D4B0a0D894556B4fE7A2e44 $AMOUNT --rpc-url $RPC --account <YOUR_KEY_OR_ACCOUNT>
Q=$(cast call 0x68329CB8eb090404026acc27E89d8FEbfdDef2af "quote(address,bool,uint256)(uint256,uint256,uint24,uint160)" <TOKEN> false $AMOUNT --rpc-url $RPC)
MIN_OUT=$(echo "$(echo "$Q" | sed -n 1p | cut -d' ' -f1) * 99 / 100" | bc)
PFEE=$(echo "$Q" | sed -n 3p | cut -d' ' -f1)
cast send 0x01E01B9d070262aD1D4B0a0D894556B4fE7A2e44 "dexSell(address,uint256,uint256,uint256,uint16,uint24,uint160)" <TOKEN> $AMOUNT $MIN_OUT $(($(date +%s)+120)) $CAP $PFEE \
1461446703485210103287273052203988822378723970341 --rpc-url $RPC --account <YOUR_KEY_OR_ACCOUNT>| 잔액과 보유자 |
event LaunchCreated(address indexed token, address indexed curve, address indexed creator, address feeRecipient,
bytes32 metadataHash, bytes32 economicsHash, uint16 creatorTaxBps, uint16 protocolShareBps,
uint256 virtualEth, uint256 graduationEth);
event CurveTrade(address indexed token, address indexed trader, bool isBuy, uint256 grossEthWei,
uint256 netEthWei, uint256 tokenAmount, uint256 baseFeeWei, uint256 creatorTaxWei, uint256 protocolFeeWei,
uint256 creatorFeeWei, uint256 reserveEthWei, uint256 tokenReserveBaseUnits, uint8 phase);
event Graduated(address indexed token, bytes32 indexed poolId, uint256 ethAddedWei, uint256 tokenAdded,
uint256 tokenLocked);
event DexTrade(address indexed token, address indexed trader, bool isBuy, uint256 grossEthWei,
uint256 netEthWei, uint256 tokenAmount, uint256 baseFeeWei, uint256 creatorTaxWei, uint256 protocolFeeWei,
uint256 creatorFeeWei);
event Transfer(address indexed from, address indexed to, uint256 value);