How ignite-market/smart-contracts works
Project type and purpose
• This is a suite of Ethereum smart contracts (no frontend) targeting prediction markets under the Ignite umbrella.
• Core deliverables:
• Conditional Tokens contract (manages positions, collateralization)
• FPMM Factory + FPMM market contract (creates and runs automated market‐maker pools)
• Ignite Oracle (connects to an external verification service—currently a dummy)
• Tooling: Hardhat as the build/test/deploy framework, Mocha/Chai for tests, ethers.js under the hood.
File structure
• Top‐level artifacts:
• hardhat.config.js, package.json, secrets.json (credentials)
• /contracts – Solidity code, broken into ConditionalTokens, FPMM, and Oracle modules
• /scripts – JS scripts that invoke Hardhat tasks to deploy each contract
• /test – Mocha test suites covering unit and full‐lifecycle scenarios
• Patterns & roles:
• Factory pattern (FPMMFactory)
• Separation of on‐chain modules (contracts/) and off‐chain orchestration (scripts/, tests/)
• Config files for multiple networks (hardhat.config.js)
Key README insights
• Indicates network “coston2” for deployment
• Deployment order and interdependencies:
1. Deploy ConditionalTokens
2. Deploy FPMMFactory (links to ConditionalTokens)
3. Deploy Oracle (needs addresses for ConditionalTokens and a verification service)
• Testing suites mirror these contracts and include helper utilities.
a. Main components to represent
• Developer/CI environment
• Hardhat framework (local node & tasks)
• Deployment & test scripts
• Ethereum network (coston2)
• On‐chain contracts:
• ConditionalTokens
• FPMMFactory → FPMM markets
• IgniteOracle → (External) Verification Service
• External verification service (DummyVerification or real API)
b. Relationships & interactions
• Scripts invoke Hardhat → network RPC → deploy or call contracts
• FPMMFactory uses ConditionalTokens library via linked address
• Oracle reads data from external service, writes results on‐chain
• Tests simulate all actor roles by calling scripts/Hardhat directly
c. Architectural patterns & design principles
• Factory pattern for market creation (FPMMFactory → new FPMM instances)
• Modular smart‐contract separation (token logic vs. market logic vs. oracle logic)
• Off‐chain orchestration (scripts/tests) decoupled from on‐chain code
d. Relevant technologies
• Solidity contracts under /contracts
• Hardhat tasks and config (hardhat.config.js)
• Deployment scripts (deploy-*.js under /scripts)
• Test suite (Mocha/Chai, utils in /test/helpers)
• Ethers.js for contract interaction