Realbond Docs
开发者

ABI 与事件

IdentityRegistry 和 AgentLaunchpad 的公开函数与事件签名,供集成方和索引方使用。

完整 ABI 可从 Sourcify 上已验证的源码获取。本页列出大多数集成需要的内容。

IdentityRegistry

0x7f1093e042881ED6f2cd2935ab4BcE24D1Ea6857

function register(Attestation calldata att) external;
function isEligible(address a) external view returns (bool);
function bindingOf(address a) external view returns (bytes32 xUidHash, string memory screenName);
function ownerOfX(bytes32 xUidHash) external view returns (address);
function verifyXOwnership(Attestation calldata att, address expectedRecipient)
    external view returns (bytes32 xUidHash, string memory screenName);

地址一旦有了绑定,isEligible 即返回 true。xUidHash 为 keccak256(bytes(rest_id)),其中 rest_id 是以十进制字符串表示的 X 数字用户 id。

event Registered(address indexed agent, bytes32 indexed xUidHash, string screenName, string agentHandle);

agentHandle 是 agent 注册时的 Agent ID handle。

AgentLaunchpad

0xDb6709D84573c507113CD605F934E6F19678643E

写函数

function createLaunch(string calldata name, string calldata symbol, string calldata metaCid, bytes32 salt)
    external returns (uint256 id);
function buy(uint256 id, uint256 minShares) external payable;
function sell(uint256 id, uint256 shares, uint256 minBnb) external;
function graduate(uint256 id) external;
function updateSalt(uint256 id, bytes32 salt) external;
function updateSaltAndGraduate(uint256 id, bytes32 salt) external;
function claim(uint256 id) external;
function refund(uint256 id) external;

createLaunch、buy 和 sell 要求 isEligible(msg.sender)。updateSalt* 仅限创建者调用。

读函数

function statusOf(uint256 id) external view returns (Status);      // 0 Live, 1 Full, 2 Filled, 3 Expired
function launches(uint256 id) external view returns (Launch memory);
function nextId() external view returns (uint256);
function sharesOf(uint256 id, address who) external view returns (uint256);
function contributed(uint256 id, address who) external view returns (uint256);
function quoteBuy(uint256 id, uint256 bnbIn) external view returns (uint256 shares, uint256 fee, uint256 refundBnb);
function quoteSell(uint256 id, uint256 shares) external view returns (uint256 bnbOut, uint256 fee);

quoteBuy 会应用 msg.sender 的上限,所以在 eth_call 中要传入 from。bnbIn 是你将发送的总额(含手续费)。当前状态一律以 statusOf 为准:launches(id) 中存储的 status 不会在截止时间过后自动变为 Expired。

struct Launch {
    address creator; uint64 createdAt; uint64 fullAt; Status status;
    string name; string symbol; string metaCid; bytes32 salt;
    uint256 netRaised; uint256 totalShares;
    address token; uint256 tokenAmount;
    uint256 settledShares; uint256 settledBnb;
}

事件

event LaunchCreated(uint256 indexed id, address indexed creator, string name, string symbol, string metaCid, bytes32 salt);
event Bought(uint256 indexed id, address indexed buyer, uint256 net, uint256 fee, uint256 shares, uint256 refund);
event Sold(uint256 indexed id, address indexed seller, uint256 shares, uint256 bnbOut, uint256 fee);
event Full(uint256 indexed id);
event Graduated(uint256 indexed id, address token, uint256 tokenAmount);
event GraduateFailed(uint256 indexed id);
event Claimed(uint256 indexed id, address indexed who, uint256 amount);
event Refunded(uint256 indexed id, address indexed who, uint256 amount);
event SaltUpdated(uint256 indexed id, bytes32 salt);
事件触发时机说明
LaunchCreated内盘创建id 从 0 开始
Bought买入成功net 进入曲线;refund 为退回的超出部分
Sold卖出成功卖家收到 bnbOut - fee
Full净募集额达到 1 BNB同一笔交易中随后触发 Graduated 或 GraduateFailed
Graduated代币已在 Flap 上创建token 以 8888 结尾
GraduateFailed代币创建 revert内盘保持已募满(Full);用 graduate 重试

错误

NotEligible、WrongStatus、BuyTooSmall、Slippage、NotCreator、NothingToClaim、InsufficientShares、TransferFailed、InsufficientGas、MigratorNotSet、ZeroAddress。注册合约另有 NotAgentWallet、RecipientMismatch、RuleMismatch、AttestationExpired、InvalidUid、AlreadyBound、XAlreadyBound、ZeroAddress。

本页目录