Solidity¶
| Pinned compiler | 0.8.26+commit.8a97fa7a (Linux binary SHA-256 d5f23436…49ef; Windows 537fd8d8…eb67) |
| EVM target | cancun (or london); never blobhash() / block.blobbasefee |
| Libraries | OpenZeppelin Contracts 5.0.2 (MIT) — the version the Wallet Studio templates use |
| Status | ✅ Tested: Foundry deploy/verify/call, ERC-20/721/1155, Wallet Studio |
Install¶
curl -L https://foundry.paradigm.xyz | bash && foundryup --install 1.8.5 # Foundry
# forge fetches solc 0.8.26 automatically when foundry.toml pins solc_version; offline: FOUNDRY_SOLC=/path/to/solc
Project structure and config¶
foundry.toml
[profile.default]
src = "src"
out = "out"
libs = ["lib"]
solc_version = "0.8.26" # pinned; matches contracts/studio/compilers.json
evm_version = "cancun" # chain 77240 runs PUSH0/MCOPY/TSTORE; never use blobhash()/blobbasefee
optimizer = true
optimizer_runs = 200
bytecode_hash = "none" # no metadata hash: deterministic runtime bytes for byte-for-byte verification
remappings = ["@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/"]
Example¶
src/Counter.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;
/// Starter counter (Solidity 0.8.26). Unaudited example.
contract Counter {
uint256 private count;
address public immutable creator;
event Incremented(uint256 value);
constructor() {
creator = msg.sender;
}
function increment() external {
count += 1;
emit Incremented(count);
}
function get() external view returns (uint256) {
return count;
}
}
Compile, ABI, deploy¶
forge build # artifacts in out/Counter.sol/Counter.json (abi, bytecode, deployedBytecode)
forge inspect Counter abi --json > Counter.abi.json
forge inspect Counter gasEstimates # compiler estimates; real gas: see the measured table
forge create src/Counter.sol:Counter --broadcast --keystore "$KEYSTORE" --password-file "$PASSWORD_FILE" --rpc-url "$RPC"
Plain solc: solc --evm-version cancun --optimize --metadata-hash none --bin --abi Counter.sol -o out.
Gas and deployment cost¶
Measured: 115,466 gas to deploy the counter, 44,587 for the first increment() (table).
Cost in PQAI = gas × (base fee + tip); with a base fee of a few wei, testnet deployment costs are negligible.
Verification¶
Byte-for-byte runtime comparison, masking immutables: Verification.
Security caveats¶
- 0.8.x checked arithmetic reverts on overflow;
uncheckedblocks remove that protection. - Do not use
block.prevrandao/block.difficultyas randomness: on PQWERAI it is the PoW difficulty. tx.originauthentication, unbounded loops over user-controlled arrays, and reentrancy before state updates are the usual sources of loss — use checks-effects-interactions and pull payments (asServiceEscrowdoes).- solc is GPL-3.0; your contract's license is your choice.
Example repository: developers/examples/first-contract/, token/, nft/ in the PQWERAI-testnet repository.
Sources at 72057fe3ec: contracts/studio/compilers.json · developers/examples/first-contract/foundry.toml · developers/examples/languages/Counter.sol
Found a problem? Report a documentation issue · Build testnet-rc1+72057fe3ec