Smart Contract Reference
Technical documentation for the AgoráX smart contract.
Contract Information
Mainnet Address
0x06856CEa795D001bED91acdf1264CaB174949bf3Network
PulseChain Mainnet (Chain ID: 369)
Native Token Address
0xEeee...eEEeEUser Write Functions
placeOrder
payableCreate a new limit order with up to 50 buy tokens.
Parameters:
- • sellToken: address
- • sellAmount: uint256
- • buyTokensIndex: uint256[]
- • buyAmounts: uint256[]
- • expirationTime: uint64
- • allOrNothing: bool
fillOrder
payableFill an existing order by providing buy tokens.
Parameters:
- • orderID: uint256
- • buyTokenIndexInOrder: uint256
- • buyAmount: uint256
cancelOrder
Cancel an order, reclaim unsold tokens, and collect any accumulated proceeds.
Parameters: orderID: uint256, recipient: address
collectProceeds
Claim all accumulated buy tokens from filled orders. If a token transfer fails, it is skipped and the remaining tokens are still collected.
Parameters: orderID: uint256, recipient: address
collectProceedsByToken
Claim proceeds for a specific buy token from an order. Useful for recovering tokens when one token in a multi-token order has transfer issues.
Parameters: orderID: uint256, buyTokenIndexInOrder: uint256, recipient: address
updateOrderExpiration
Extend an order's expiration time.
Parameters: orderID: uint256, newExpiration: uint64
cancelAllExpiredOrders
Batch cancel all expired orders (max 50) and collect any accumulated proceeds.
Parameters: recipient: address
Key View Functions
| Function | Purpose |
|---|---|
| getOrderDetails(orderID) | Get full order information |
| viewUserOpenOrders(user, cursor, size) | List user's active orders |
| viewUserExpiredOrders(user, cursor, size) | List user's expired orders |
| viewCollectableProceeds(orderID) | Check claimable amounts |
| findFillableOrders(sellToken, minAmount, cursor, size) | Search for fillable orders by sell token |
| viewActiveWhitelisted(cursor, size) | Get tradable tokens |
| getTotalOrderCount() | Platform statistics |
| listingFee() | Current listing fee |
| protocolFee() | Current protocol fee (basis points) |
Contract Constants
Max Buy Tokens Per Order
50
Max Batch Cancel
50 orders
Cooldown Period
20 - 86,400 seconds
Protocol Fee
basis points (100 = 1%)
Gas Estimates
| Function | Approximate Gas |
|---|---|
| placeOrder | 150k - 300k |
| fillOrder | 120k - 200k |
| cancelOrder | 80k - 150k |
| collectProceeds | 80k - 150k |
| collectProceedsByToken | 60k - 100k |
| updateExpiration | 50k - 70k |
Events
OrderPlaced(address indexed user, uint256 indexed orderID, ...)
OrderCancelled(address indexed user, uint256 indexed orderID)
OrderFilled(address indexed buyer, uint256 indexed orderID, ...)
OrderProceedsCollected(address indexed user, uint256 indexed orderID, uint256[] buyTokenIndices, uint256[] amountsCollected)
ProceedsCollectionFailed(address indexed user, uint256 indexed orderID, address failedToken)
OrderExpirationUpdated(uint256 indexed orderID, uint64 newExpiration)