바이프로스트 네트워크
  • 소개
  • 바이프로스트 네트워크 구조
    • 합의
    • 크로스체인 커뮤니케이션 프로토콜 (CCCP)
    • 오라클 서비스
  • 노드 운영 매뉴얼
    • 기본 노드 요구 사항
    • 풀 노드 요구 사항
    • 검증자 계정 관리
    • 운영자 가이드
      • 엔드포인트 (Endpoint) 노드 셋업
        • 도커 셋업
        • Systemd 셋업
      • 검증자 노드 셋업
        • 도커 셋업
        • Systemd 셋업
      • 릴레이어 셋업
        • bifrost-relayer.rs
      • 체인 데이터 스냅샷
      • 문제 해결
        • 테스트넷 체인 동기화 이슈
    • 시스템 모니터링
      • Prometheus and Grafana
      • Sentry
  • 노미네이터
  • 개발자 문서
    • 이더리움 API
      • 프리컴파일 컨트랙트
      • 개발자 라이브러리
      • 개발자 환경
    • 바이프로스트 프리컴파일 컨트랙트
      • 스테이킹
      • 거버넌스
      • 릴레이 매니저
    • 팔렛 인터페이스
      • BfcStaking
      • BfcUtility
      • BfcOffences
      • RelayManager
    • 클라이언트 API
      • JSON-RPC API
        • author
        • chain
        • childstate
        • debug
        • eth
        • grandpa
        • net
        • offchain
        • payment
        • rpc
        • state
        • system
        • trace
        • txpool
        • web3
      • 익스플로러 API
      • 런타임 API
    • 크로스체인 트랜잭션 및 오라클 API
      • 가격 오라클 컨트랙트 API
      • 소켓 컨트랙트 API
    • 바이프로스트 테스트넷 BFC 토큰 수령 방법
  • 거버넌스
  • 보안
  • 토큰 & 자산
    • 유니파이드 토큰
    • 인플레이션 모델
  • Add Network
    • 포키
    • 메타마스크
  • Bridge
    • 브릿지 가이드
      • 바이프로스트 네트워크로 예치
      • 다른 네트워크로 출금
    • 용어
  • Staking
    • 스테이킹 가이드
      • BFC 스테이킹
      • BFC 언스테이크
    • 용어
      • 모든 밸리데이터
      • 스테이킹 현황
  • Language
    • Bifrost Network Guide
Powered by GitBook
On this page
  • Interfaces of Vault contract
  • Interfaces of Socket contract
  1. 개발자 문서
  2. 크로스체인 트랜잭션 및 오라클 API

소켓 컨트랙트 API

볼트 컨트랙트 (vault contract)는 사용자 요청의 진입점입니다. 사용자가 자신의 암호화폐로 브랏지 (Bridge) 또는 브리지앤콜 (BridgeAndCall)을 요청하면, 볼트 컨트랙트는 반대 방향의 브리지 요청이 발생할 때까지 해당 암호화폐를 안전하게 잠급니다.

소켓 컨트랙트 (socket contract)는 사용자나 릴레이어로부터 이벤트 메시지를 수신하고 검증합니다. 요청된 메시지가 유효하다고 판단되면, 소켓 컨트랙트는 요청에 명시된 액션 (예: 민팅, 대출, 레버리지 투자)을 실행하고 이러한 액션이 올바르게 실행되었는지 확인합니다.

Interfaces of Vault contract

interface IVault {
    // Events that occur when a user's request is generated or an asset is processed
    event Vault(uint8 type_, uint128 asset_id_, uint256 amount_);
    
    // Function that returns the address of the associated WBFC
    function WBFC() view returns (address);
    // Function that returns the address of the associated socket
    function socket() view returns (address);
    // Function that returns the address of the associated swap router
    function swap_router() view returns (address);
    
    // Entry point for the user to initiate a CCCP request
    function request(User_Request memory user_request) payable returns (bool);
    // Entry point for socket to execute user request
    function execute(Instruction memory instruction) returns (bool);
    // Entry point for socket to complete user request
    function resolve(Task_Params memory params) returns (bool);
    // Entry point for socket to rollback user request
    function rollback(Task_Params memory params) returns (bool);
    // Entry point to provide the liquidity
    function liquidity_deposit(uint128 _asset_index, uint256 _amount) payable returns ();
    
    // Function that returns a value that identifies the native coin in which the contract was deployed
    function this_chain_coin_index() view returns (uint128);
    // Function that returns the fee rate
    function fee_rate() view returns (uint256);
    
    // Function that returns the handler address of the associated lending service
    function lending_handlers(uint128) view returns (address);
    
    // Function that returns a value that identifies the asset(coin, token)
    function get_asset_id(address) view returns (uint128);
    // Function that returns a token(coin) registered with an asset identification value
    function assets(uint128) view returns (AssetInfo memory asset_info);

    struct Asset_Config {
        uint128 min_amount;
        uint128 max_amount;
        uint32 _type;
        uint64 fee_rate;
        address target;
    }
    struct AssetInfo {
        Asset_Config config;
        uint256 amount;
        uint256 fee;
    }
    struct User_Request {
        Instruction ins_code;
        Task_Params params;
    }

    struct Instruction {
        ChainIndex chain;
        RBCmethod method;
    }
    struct Task_Params {
        Asset_Index tokenIDX0; Asset_Index tokenIDX1;
        address refund;
        address to;
        uint256 amount;
        bytes variants;
    }
}

Interfaces of Socket contract

interface ISocket {
    // Events that occur when relayer submits a round_up poll or when the round_up poll reaches majority
    event RoundUp(Task_Status status, Round_Up_Submit roundup);
    // An event that occurs when a user generates a request or when the request state is transitioned by relayer's poll
    event Socket(Socket_Message msg);
    
    // Entry point for user requests passed by Vault
    function user_executor(User_Request calldata request) external returns (bool)
    // Entry point for relayer to process user requests
    function poll(Poll_Submit calldata _submit) external returns (bool returnData)
    // Entry point for user to rollback unprocessed requests
    function timeout_rollback(RequestID calldata request, User_Request calldata _req) external returns (bool)
    
    // Function that returns a filter that records whether relayer has properly "poll" for the request
    function get_poll_filter(RequestID calldata _rid, address _sender) external view returns (uint256)
    // Function that returns stored request information
    function get_request(RequestID calldata _rid) external view returns(RequestInfo memory)
    // Function that returns signature information submitted by relayer for round update
    function get_round_signatures(uint256 _round) external view returns (Signatures memory)
    // Function that returns the signature submitted by relayer for processing the user's request
    function get_signatures(RequestID memory _rid, Task_Status _status) external view returns (Signatures memory)
    
    // Function that returns the address of the associated authority
    function authority() view returns (address)
    // Function that returns the address of the associated oracle manager
    function orc_manager() view returns (address)
    // Function that returns the address of the associated vault
    function vault() view returns (address)
    
    // Function that returns a value that identifies the chain in which the contract was deployed
    function this_chain() view returns (uint64)
    // Function that returns the number of requests generated by the user
    function sequence() view returns (uint128)
    // Function that returns a timeout value for rollback
    function timeout_blocks() view returns (uint256)
    
    // Entry point for relayer to update the round of native network
    function round_control_relay(Round_Up_Submit calldata _round_up_submit) external returns (bool)
    
    // --- only on BIFROST network ---
    
    // The entry point for relayer to feed Oracle of aggregate type
    function oracle_aggregate_feeding(Oracle_ID[] memory oids, bytes32[] memory data) onlyRelayer external returns (bool)
    // The entry point for relayer to feed Oracle of consensus type
    function oracle_consensus_feeding(Oracle_ID[] memory oids, uint128[] memory rounds, bytes32[] memory data) onlyRelayer external returns (bool)
    // The entry point for submitting a signature to update the round of the native network
    function round_control_poll(Round_Up_Submit calldata _round_up_submit) external returns (bool)

    type ChainIndex is uint64;
    type RBCmethod is uint64;
    type Asset_Index is uint128;
    type Oracle_ID is bytes32;

    struct Socket_Message {
        RequestID req_id;
        Task_Status status;
        Instruction ins_code;
        Task_Params params;
    }

    struct Poll_Submit {
        Socket_Message msg;
        Signatures sigs;
        uint256 option;
    }

    struct Instruction {
        ChainIndex chain;
        RBCmethod method;
    }

    struct Task_Params {
        Asset_Index tokenIDX0; Asset_Index tokenIDX1;
        address refund;
        address to;
        uint256 amount;
        bytes variants;
    }

    struct RequestID {
        ChainIndex chain;
        uint64 round_id;
        uint128 sequence;
    }

    struct Signatures {
        bytes32[] r;
        bytes32[] s;
        bytes     v;
    }

    struct Round_Up_Submit {
        uint256 round;
        address[] new_relayers;
        Signatures sigs;
    }

    enum Task_Status {
        None,
        Requested,
        Failed,
        Executed,
        Reverted,
        Accepted,
        Rejected,
        Committed,
        Rollbacked,
        Round_Up,
        Round_Up_Committed
    }
}
Previous가격 오라클 컨트랙트 APINext바이프로스트 테스트넷 BFC 토큰 수령 방법

Last updated 7 days ago