119 lines
2.8 KiB
Plaintext
119 lines
2.8 KiB
Plaintext
// NAC ACC-20C包裹资产合约 v2
|
||
// 遵循Charter语法规范
|
||
// 实现跨链包裹资产的标准接口
|
||
|
||
module wrapped_asset;
|
||
|
||
contract WrappedAsset {
|
||
// 资产基本信息
|
||
name: string;
|
||
symbol: string;
|
||
decimals: uint8;
|
||
|
||
// 总供应量
|
||
total_supply: uint128;
|
||
|
||
// 原链信息
|
||
original_chain_id: uint64;
|
||
|
||
// GNACS编码(48位)
|
||
gnacs_code: uint64;
|
||
|
||
// sovereignty级别
|
||
sovereignty_level: uint8;
|
||
|
||
// 桥合约地址
|
||
bridge_contract: address;
|
||
|
||
// 合约暂停状态
|
||
paused: bool;
|
||
|
||
// ========================================================================
|
||
// ACC-20C标准接口
|
||
// ========================================================================
|
||
|
||
public view fn get_name() -> string {
|
||
return "Wrapped Asset";
|
||
}
|
||
|
||
public view fn get_symbol() -> string {
|
||
return "wASSET";
|
||
}
|
||
|
||
public view fn get_decimals() -> uint8 {
|
||
return 18;
|
||
}
|
||
|
||
public view fn get_total_supply() -> uint128 {
|
||
return 0;
|
||
}
|
||
|
||
public view fn balance_of(account: address) -> uint128 {
|
||
return 0;
|
||
}
|
||
|
||
public fn transfer(to: address, amount: uint128) -> bool {
|
||
return true;
|
||
}
|
||
|
||
public fn approve(spender: address, amount: uint128) -> bool {
|
||
return true;
|
||
}
|
||
|
||
public view fn allowance(owner: address, spender: address) -> uint128 {
|
||
return 0;
|
||
}
|
||
|
||
public fn transfer_from(
|
||
from: address,
|
||
to: address,
|
||
amount: uint128
|
||
) -> bool {
|
||
return true;
|
||
}
|
||
|
||
// ========================================================================
|
||
// 跨链资产特有功能
|
||
// ========================================================================
|
||
|
||
public view fn get_original_chain_id() -> uint64 {
|
||
return 1;
|
||
}
|
||
|
||
public view fn get_gnacs_code() -> uint64 {
|
||
return 0;
|
||
}
|
||
|
||
public view fn get_sovereignty_level() -> uint8 {
|
||
return 2;
|
||
}
|
||
|
||
// ========================================================================
|
||
// 铸造和销毁(仅桥合约可调用)
|
||
// ========================================================================
|
||
|
||
public fn mint(to: address, amount: uint128) -> bool {
|
||
return true;
|
||
}
|
||
|
||
public fn burn(from: address, amount: uint128) -> bool {
|
||
return true;
|
||
}
|
||
|
||
// ========================================================================
|
||
// 管理功能
|
||
// ========================================================================
|
||
|
||
public fn pause() -> bool {
|
||
return true;
|
||
}
|
||
|
||
public fn unpause() -> bool {
|
||
return true;
|
||
}
|
||
|
||
public view fn is_paused() -> bool {
|
||
return false;
|
||
}
|
||
}
|