84 lines
2.7 KiB
Plaintext
84 lines
2.7 KiB
Plaintext
# ACC-20C 兼容层协议 - 主接口文件
|
||
# 版本: 1.0
|
||
# 路径: charter-std/acc/acc20c.ch
|
||
|
||
# --- 核心原则 ---
|
||
# 1. 统一入口: 本文件是 ACC-20C 协议在 Charter 合约层的唯一入口点。
|
||
# 2. 模块化: 导入并重新导出 Wrapper, Metadata, Sync 三个核心模块的接口。
|
||
# 3. 接口标准化: 定义清晰的 IAcc20C 接口,供其他合约调用。
|
||
|
||
# --- 模块导入 ---
|
||
|
||
# 导入并公开包装器模块
|
||
pub mod wrapper from "./acc20c_wrapper.ch";
|
||
|
||
# 导入并公开元数据模块
|
||
pub mod metadata from "./acc20c_metadata.ch";
|
||
|
||
# 导入并公开状态同步模块
|
||
pub mod sync from "./acc20c_sync.ch";
|
||
|
||
# --- 标准库导入 ---
|
||
import std::types::{ Address, Uint256, Bool, String };
|
||
|
||
# --- 统一接口定义 (IACC20C) ---
|
||
|
||
# @dev 定义 ACC-20C 协议的统一外部接口
|
||
# 其他合约应通过此接口与 ACC-20C 交互
|
||
interface IAcc20C {
|
||
|
||
# --- Wrapper 功能 ---
|
||
|
||
# @dev 包装一个 ACC-20 资产
|
||
fn wrap(acc20_contract: Address, acc20_token_id: Uint256) -> Uint256;
|
||
|
||
# @dev 解包一个已包装的资产
|
||
fn unwrap(wrapper_token_id: Uint256);
|
||
|
||
# @dev 转移一个包装后资产的所有权
|
||
fn transfer(to: Address, wrapper_token_id: Uint256);
|
||
|
||
# @dev 查询包装后资产的详情
|
||
fn get_wrapped_asset(wrapper_token_id: Uint256) -> wrapper::WrappedAsset;
|
||
|
||
# @dev 查询包装后资产的所有者
|
||
fn owner_of(wrapper_token_id: Uint256) -> Address;
|
||
|
||
# --- Metadata 功能 ---
|
||
|
||
# @dev 为指定的包装资产生成完整的元数据 URI
|
||
fn token_uri(wrapper_token_id: Uint256) -> String;
|
||
|
||
# --- Sync 功能 (仅限授权服务调用) ---
|
||
|
||
# @dev 由区块扫描器调用,以更新底层资产估值
|
||
fn update_valuation(acc20_contract: Address, acc20_token_id: Uint256, new_valuation: Uint256);
|
||
|
||
# @dev 由区块扫描器调用,处理底层资产状态的重大变更
|
||
fn handle_critical_status_change(acc20_contract: Address, acc20_token_id: Uint256, new_status_code: Uint64);
|
||
}
|
||
|
||
# --- 占位符函数 (保持向后兼容性) ---
|
||
# 这些函数将被废弃,但暂时保留以避免破坏现有引用。实际逻辑由宪法层处理。
|
||
|
||
pub fn verify_compliance(holder: Address) -> bool {
|
||
# [DEPRECATED] 合规性检查已移至宪法层 (CEE)
|
||
# 此函数始终返回 true,实际检查由 CBPP 在交易准入时强制执行
|
||
return true;
|
||
}
|
||
|
||
pub fn add_to_whitelist(account: Address) -> bool {
|
||
# [DEPRECATED] 白名单机制已被 CNNL 宪法条款取代
|
||
return true;
|
||
}
|
||
|
||
pub fn remove_from_whitelist(account: Address) -> bool {
|
||
# [DEPRECATED] 白名单机制已被 CNNL 宪法条款取代
|
||
return true;
|
||
}
|
||
|
||
pub fn is_whitelisted(account: Address) -> bool {
|
||
# [DEPRECATED] 白名单机制已被 CNNL 宪法条款取代
|
||
return true;
|
||
}
|