tejas0111/pharos/gas-optimization
Claude Code and agent skill by tejas0111/pharos
Trust tier 3
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
Install
npx vskill@latest install tejas0111/pharos/gas-optimizationSKILL.md
The same SKILL.md was published earlier as tejas0111/pharos/gas-optimization.
Gas Optimization
Overview
Optimize Solidity contract gas usage for the Pharos ecosystem. Pharos uses a Dual-VM architecture (EVM + WASM via DTVM) with SALI-aware storage and EIP-1559 fee market. Each Pharos-specific feature changes the optimization calculus vs Ethereum.
Pharos-Specific Gas Model
| Feature | Pharos | Ethereum | |
|---|---|---|---|
| VM | DTVM (EVM + WASM) | EVM only | |
| Block Gas Limit | 1B gas | 30M gas | |
| Fee Model | EIP-1559 | EIP-1559 | |
| Storage | SALI-friendly | Standard | |
| Calldata | 4 gas/byte (0-calldata ops cheaper) | 16 gas/byte |
Real Contract Optimizations
1. Struct Packing (SALI-Friendly)
Pharos's SALI (Storage Access Layer Interface) rewards tightly packed storage slots. Compare:
Inefficient (3 slots):
Optimized (2 slots):
Real example:contracts/PharosLendingPool.soluses aPositionstruct — packingtimestampnext toamountssaves ~14k gas per liquidation.
2. Use calldata Instead of memory
Real example:contracts/PharosSPNPaymaster.solpassesPackedUserOperation calldata— 95% gas savings vs memory.
3. Custom Errors Over Strings
Real example: Every contract in the project uses custom errors.contracts/DEXPool.solsaves ~23k gas per revert vs string errors.
4. Batch Operations
Real example:contracts/PharosSPNPaymaster.solhasaddSponsors()— saves 21,000 gas vs N individual calls.
5. Use uint256 for Gas-Only Values
Despite packing advice, use uint256 for values that are:
- Compared against
msg.value(always uint256) - Used in
block.timestamparithmetic - Divided/multiplied (Solidity casts anyway)
Real example:contracts/StakingPool.solusesuint256fors_rewardRatesince it's involved in division — prevents implicitcastcosts.
Testing Gas
Covers:contracts/StakingPool.solstake function should be <100k gas.
Optimization Cheat Sheet
| Technique | Savings | Where Applied | |
|---|---|---|---|
| Struct packing | ~14k gas/write | LendingPool, StakingPool | |
| Custom errors | ~23k gas/revert | All contracts | |
| calldata params | ~3.5k gas/call | SPN Paymaster, DEXPool | |
| Batch operations | ~21k gas/batch | SPN Paymaster | |
| Unchecked blocks | ~200 gas/op | DEXPool loops | |
| Short-circuit | Varies | Or conditions in all contracts | |
| Pre-increment | ~5 gas/loop | ++i vs i++ in loops |
References
contracts/PharosLendingPool.sol— struct packing examplecontracts/PharosSPNPaymaster.sol— calldata + batch patternscontracts/DEXPool.sol— unchecked math + custom errors
Security
- Security scanPassed, 98 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskill/subskills/gas-optimization/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/tejas0111/pharos/gas-optimization)