ICrossInscribe

The ICrossInscribe interface defines a set of operations related to cross-chain signing and address binding.

一. The Owner‘s Method

setValidatorAgreeCount(uint256 agreeCount)

Purpose: Sets the validator agreement count.

Parameter: Agree count (uint256).

setBridgeCosts(uint256 newFee)

Purpose: Sets the new bridge cost.

Parameter: New bridge cost (uint256).

getBridgeCosts()

Purpose: Retrieves the current bridge cost.

changeBindAddressFee(uint256 newFee)

Purpose: Changes the binding address fee.

Parameter: New binding address fee (uint256).

getBindAddressFee()

Purpose: Retrieves the current binding address fee.

setValidatorContract(address account)

Purpose: Sets the validator contract address.

Parameter: Validator contract address (address).

getValidatorContract()

Purpose: Retrieves the current validator contract address.

refundFee(address payable toUser, uint256 amount)

Refunds a fee to a user.

refundInscrition(address toUser, string memory tick, uint256 amount)

Purpose: Refunds an inscription to a user

二. User‘s Method

bindAddress(string memory btcAddress, bytes memory btcSignature)

Purpose: Binds a BTC address to an EVM address, requires a fee. Need User to Sign a btc address and

EVM address.

btcSignature need 65 byte, and add v at the signature front。

let v = sig.recid
if (v < 27) {
    v += 27;
}
let signature = new Uint8Array(65)
signature[0] = v;
for(let i =0; i < sig.signature.length; i++) {
    signature[i+1] = sig.signature[i];
}

三.Validator's Method

bindAddressResponse(address user, uint256 nonce)

Purpose: Handles response for binding a BTC address.

The validator verifies the user's signature and submits the result。

getBoundBtcAddress(address evmAddress)

Purpose: Retrieves the bound BTC address for a given EVM address.

getBoundEVMAddress(string memory btcAddress)

Purpose: Retrieves the bound EVM address for a given BTC address.

bridgeToBTCResponse(address fromUser, uint256 nonce)

Purpose: Validator handles response for a cross-chain transaction to BTC.

bridgeToBTCConfirm(address fromUser, uint256 nonce, bytes32 txID)

Purpose: Confirms a cross-chain transaction to BTC

confirmBridgeBtcToEth(string memory txid, string memory inscriptonID, string memory inscription, string memory tick, uint256 amount, address toAddress)

Purpose: Confirms a cross-chain transaction from BTC to ESC

.

Last updated