sb-dev/openquant / .agents/skills/spec-to-code-compliance
spec-to-code-compliance
VerifiedCheck implementation code against its specification, protocol, whitepaper, or design document. Trace each requirement to evidence, report contradictions and missing or partial enforcement, and find undocumented behavior.
upstream/evals/documents-contradict/fixture/Vault.sol
View on GitHub// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;
interface IFeeSink {
function record(address account, uint256 amount) external;
}
/// @notice Member vault with locked collateral and tiered redemption handling.
contract Vault {
enum Tier {
Standard,
Senior
}
uint256 public constant FEE_BPS = 50;
IFeeSink public immutable feeSink;
address public immutable admin;
mapping(address => uint256) public balances;
mapping(address => uint256) public locked;
mapping(address => Tier) public tier;
uint256 public totalHeld;
bool public paused;
event Deposited(address indexed account, uint256 amount);
event Redeemed(address indexed account, uint256 amount, uint256 fee);
error Paused();
error NotAdmin();
error CollateralShortfall();
error NothingToRedeem();
constructor(IFeeSink sink) {
feeSink = sink;
admin = msg.sender;
}
modifier notPaused() {
if (paused) revert Paused();
_;
}
modifier onlyAdmin() {
if (msg.sender != admin) revert NotAdmin();
_;
}
function deposit(uint256 amount) external notPaused {
balances[msg.sender] += amount;
totalHeld += amount;
emit Deposited(msg.sender, amount);
}
/// @notice Lock collateral against a member's balance.
function lock(address account, uint256 amount) external onlyAdmin {
locked[account] += amount;
}
/// @notice Redeem part of a member's balance, net of the redemption fee.
function redeem(uint256 amount) external notPaused returns (uint256) {
if (amount == 0) revert NothingToRedeem();
if (!_collateralPreserved(msg.sender, amount)) revert CollateralShortfall();
uint256 fee = (amount * FEE_BPS) / 10_000;
uint256 payout = amount - fee;
balances[msg.sender] -= amount;
totalHeld -= amount;
feeSink.record(msg.sender, fee);
emit Redeemed(msg.sender, amount, fee);
return payout;
}
/// @notice Whether the account keeps enough balance to cover its locked collateral.
function _collateralPreserved(address account, uint256 amount) internal view returns (bool) {
if (tier[account] == Tier.Senior) {
return true;
}
return balances[account] - amount >= locked[account];
}
function setTier(address account, Tier newTier) external onlyAdmin {
tier[account] = newTier;
}
function setPaused(bool value) external onlyAdmin {
paused = value;
}
/// @notice Move a member's balance to another account.
function reassign(address from, address to) external onlyAdmin {
uint256 amount = balances[from];
balances[from] = 0;
balances[to] += amount;
locked[to] += locked[from];
locked[from] = 0;
}
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 321k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |