用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/genlayerlabs/intelligent-oracle --skill write-contract命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | write-contract |
| description | Write production-quality GenLayer intelligent contracts for this intelligent-oracle repo. |
| allowed-tools | ["Bash","Read","Write","Edit","Grep","Glob"] |
Use this skill for changes under intelligent-contracts/.
This repo has two GenLayer contracts:
IntelligentOracle.py stores prediction-market oracle config and resolves outcomes.IntelligentOracleFactory.py is the registry/factory used by the Next API deploy route and the explorer.Always run:
genvm-lint check intelligent-contracts/*.py
python -m pytest test/ -v
Preserve the public ABI consumed by the app:
__init__(intelligent_oracle_code: str)create_new_prediction_market(...)get_contract_addresses()__init__(prediction_market_id, title, description, potential_outcomes, rules, data_source_domains, resolution_urls, earliest_resolution_date)resolve(evidence_url: str = "")get_dict()get_status()If any of these change, update all of:
src/app/api/bridge/deploy-intelligent-oracle/route.tssrc/lib/genlayer-client.tssrc/lib/genlayer-hooks.tsscripts/deploy.tstest/Production contracts use:
# { "Depends": "py-genlayer:test" }
Direct-mode tests may rewrite that header through test/tools/contracts.py. Do not change test helper behavior unless the direct-mode runner requires it.
DynArray and TreeMap.list or dict fields.DynArray values instead of assigning Python arrays.Example:
class IntelligentOracle(gl.Contract):
prediction_market_id: str
potential_outcomes: DynArray[str]
creator: Address
def __init__(self, prediction_market_id: str, potential_outcomes: list[str]):
self.prediction_market_id = prediction_market_id
for outcome in potential_outcomes:
self.potential_outcomes.append(outcome.strip())
self.creator = gl.message.sender_address
Keep validation aligned with the TypeScript OracleConfig schema:
predictionMarketId, title, description, rules, and earliestResolutionDate.potentialOutcomes.dataSourceDomains or resolutionURLs.Use deterministic code outside nondeterministic blocks. For web and AI calls inside resolve, keep nondeterminism behind GenLayer APIs:
gl.nondet.web.get(...)gl.nondet.exec_prompt(...)gl.eq_principle.prompt_comparative(...) or a custom validator if comparison needs stricter controlDo not move contract AI calls to the root Next API or AI SDK. The migration policy is:
LLM responses must be parsed defensively. Keep JSON extraction narrow and tolerate wrappers, but fail safely:
def _parse_json_dict(json_str: str) -> dict:
if isinstance(json_str, dict):
return json_str
first_brace = json_str.find("{")
last_brace = json_str.rfind("}")
if first_brace == -1 or last_brace == -1:
return {}
json_str = json_str[first_brace : last_brace + 1]
json_str = re.sub(r",(?!\s*?[\{\[\"\'\w])", "", json_str)
return json.loads(json_str)
When changing prompts, keep outputs valid JSON and keep the outcome field constrained to one of the configured outcomes, UNDETERMINED, or ERROR.
Use gl.vm.UserError for expected contract-level reverts. Keep error messages stable when tests or UI may inspect them.
Important existing states:
ActiveResolvedErrorAdd or update direct-mode pytest coverage for:
resolution_urls.get_dict() response shape.Run root verification after contract changes when TypeScript integrations may be affected:
npm run check