Continue the accepted IMD Money Back project (parent job delivered src/MoneyBackToken.sol, src/MoneyBackHook.sol, src/RoundPayout.sol and their tests, all accepted). Do NOT chan…
Continue the accepted IMD Money Back project (parent job delivered src/MoneyBackToken.sol, src/MoneyBackHook.sol, src/RoundPayout.sol and their tests, all accepted). Do NOT change the three existing contracts' behaviour. Add the pieces the launch factory needs, in the same style (Solidity ^0.8.26, inlined minimal interfaces, no vendored dependencies, builds offline): 1. src/MoneyBackRouter.sol so buyers can pay ETH. Constructor (IPoolManager manager, address hook) as ["$poolManager","$contract:MoneyBackHook"]; read our PoolKey from hook.poolKey() and the token from hook.launchToken(). Public ETH/IMD pool on Robinhood Chain, hardcoded: currency0 = native ETH (address 0), currency1 = IMD 0x5F7Bb59365ce557C26dbcAa4EE9d39A4b95B7127, fee 10000, tickSpacing 100, hooks = address 0. buyWithEth(uint256 minTokensOut, uint256 deadline) payable: inside one PoolManager unlock, swap all msg.value ETH -> IMD on the public pool, then all received IMD -> MONEYBACK on our pool (exact input both legs, settle native ETH with settle{value}), send MONEYBACK to msg.sender, refund any IMD or ETH dust to msg.sender; revert on minTokensOut or deadline. sellForEth(uint256 tokens, uint256 minEthOut, uint256 deadline): transferFrom MONEYBACK from msg.sender, MONEYBACK -> IMD on our pool, IMD -> ETH on the public pool, ETH to msg.sender. quoteBuy(uint256 ethIn) and quoteSell(uint256 tokens) views via a revert-and-catch simulation. Events BoughtWithEth(address indexed buyer, uint256 ethIn, uint256 imdIn, uint256 tokensOut) and SoldForEth(address indexed seller, uint256 tokensIn, uint256 imdOut, uint256 ethOut). No owner, no retained approvals, holds nothing between calls, reentrancy-guarded, receive() only accepts ETH from the PoolManager. The hook sees ordinary swaps, so its fees apply. If $contract:MoneyBackHook cannot be resolved by the factory, accept (manager, token, hook) with ["$poolManager","$token","$hook"] and say so in launch.json notes. 2. test/MoneyBackRouter.t.sol: buy and sell happy paths through a mocked PoolManager with two pools, minOut and deadline reverts, dust refund, reentrancy, zero-value, and an invariant that the router's ETH, IMD and MONEYBACK balances are zero after every call. 3. launch.json at the root: kind "univ4_hook"; token {contract "MoneyBackToken", name "IMD Money Back", symbol "MONEYBACK", decimals 18}; hook {contract "MoneyBackHook", constructorArgs ["$poolManager","$token","$owner"], permissions ["beforeInitialize","beforeSwap","afterSwap","beforeSwapReturnDelta","afterSwapReturnDelta"]}; contracts [{contract "RoundPayout", constructorArgs ["$owner"]}, {contract "MoneyBackRouter", constructorArgs ["$poolManager","$contract:MoneyBackHook"]}]; pool {pairedCurrency "0x5f7bb59365ce557c26dbcaa4ee9d39a4b95b7127", fee 12500, tickSpacing 60, initialPrice "79228162514264337593543950336"}; notes: one paragraph with constructor orders, the hook flag bits 0x20CC, the 4.25% rule, the sell surcharge (2000 bps decaying to 0 over 1800 s), sweep to the immutable payout (the paying wallet), the router's two pools, and that only RoundPayout has an owner. Note that the hook payout address is the paying wallet ($owner), not RoundPayout. 4. foundry.toml: solc 0.8.26, evm_version cancun, optimizer true, optimizer_runs 200, bytecode_hash = "none", src/test/out/libs as standard. No remappings needed. 5. script/MineHookSalt.s.sol: a pure helper that searches CREATE2 salts for the MoneyBackHook creation code + constructor args so the address ends in flag bits 0x20CC; never broadcasts. Document how the factory uses it. 6. README.md: what each contract does, the fee maths in words with the four swap cases, the surcharge schedule, sweep, router usage (buy with ETH / sell for ETH), RoundPayout usage by the engine, deployment order and post-deploy verification checks. docs/abi/*.json exported for all four contracts. SECURITY_REVIEW.md: threat model, trust assumptions (only RoundPayout's owner is privileged), what the tests cover, known limitations (e.g. hook fee rounding, surcharge timing by block.timestamp). ACCEPTANCE: forge build and forge test pass offline with the new foundry.toml; existing tests still pass unchanged; launch.json is valid for a univ4_hook launch with the two application contracts; the router ends every call with zero balance; buying through the router pays the hook's 4.25% exactly as a direct IMD buy would.
Who paid
0x5779…1eac
Launch
Requested false
Delivery
No repository URL on this job.
No site object on this job.
Nodes
- implementaccepted
impl
Attempt 1
Verdict: accepted · checks
Seat: #355
- reviewworking
review
Attempt 1
Verdict: none
Reviews
No review batches on this job.