5.2 IBC-Bitcoin
Contract Interface
struct DepositItem {
bytes32 txid;
uint vout;
uint amount;
bytes scriptPubKey;
address toAddr;
address extraToAddr;
bool deposited;
bytes32 depositPubKeyX;
bytes32 depositPubKeyY;
}
struct WithdrawItem {
uint wtype; // 0: default, 1: send to cold
uint withdrawId;
bytes destination;
uint amount;
}
struct Utxo {
bytes32 txid;
uint vout;
uint amount;
bytes scriptPubKey;
bool used;
}
struct WithdrawTx {
bytes32 suggestHash;
bytes32[] keyHashs;
bytes32[] inputHashs;
uint outputStart;
uint outputSize;
uint fee;
uint change;
}
struct Destination {
address toAddr;
address extraToAddr;
}
mapping(bytes32 => DepositItem) public deposits;
mapping(uint => WithdrawItem) public withdrawals;
mapping(bytes32 => Utxo) public utxos;
mapping(uint => WithdrawTx) public suggestions;
mapping(uint => WithdrawTx) public selections;
mapping(uint => bytes32) public utxoKeys;
mapping(bytes32 => mapping(bytes32 => Destination)) public depositDestinations;
mapping(bytes32 => bool) public isUsedMappingHash;
bool public isActivated = true;
uint public utxoCount = 0;
uint public validUtxoCount = 0;
uint public withdrawalCount = 0;
uint public withdrewCount = 0;
uint public suggestCount = 0;
uint public selectionCount = 0;
uint public btcBalance = 0;
uint public holdingLimit = 0;
address tokenAddr = 0x0000000000000000000000000000000000000001;
bytes coldAddr;
bytes public redeemScript;
event DepositDestinationsMapping(bytes32 btcPubKeyX, bytes32 btcPubKeyY, address toAddr, address extraToAddr);
event DepositRelay(bytes32 txid, uint vout, uint amount, bytes scriptPubKey, bytes32 depositPubKeyX, bytes32 depositPubKeyY);
event DepositValidated(bytes32 txid, uint vout, uint amount, bytes scriptPubKey, address toAddr, address extraToAddr, bytes32 depositPubKeyX, bytes32 depositPubKeyY);
event WithdrawAdded(address balanceAddr, uint wtype, uint withdrawId, address user, uint withdrawIndex, bytes32 tokenSummary, bytes destination, uint amount);
event TxSuggestAdded(bytes32 suggestHash, uint suggestIndex, bytes32[] keyHashs, bytes32[] inputHashs, uint outputStart, uint outputSize, uint fee, uint change);
event TxSuggestRelay(bytes32 suggestHash, uint suggestIndex, bytes32[] keyHashs, bytes32[] inputHashs, uint outputStart, uint outputSize, uint fee, uint change);
event TxSelected(uint selectionIndex, bytes32[] keyHashs, bytes32[] inputHashs, uint outputStart, uint outputSize, uint fee, uint change);
event TxSelectedRelay(uint selectionIndex, bytes32[] keyHashs, bytes32[] inputHashs, uint outputStart, uint outputSize, uint fee, uint change);
event WithdrawValidated(uint selectionIndex, bytes32[] keyHashs, bytes32[] inputHashs, uint outputStart, uint outputSize, uint fee);
event UsableUtxoRelay(bytes32 txid, uint vout, uint amount, bytes scriptPubKey);
event UtxoAdded(uint utxoIndex, bytes32 txid, uint vout, uint amount, bytes scriptPubKey, bytes32 keyHash);
function getSuggestKeyHashs(uint suggestIndex) public view returns(bytes32[] memory)
function getSuggestInputHashs(uint suggestIndex) public view returns(bytes32[] memory)
function getSelectionKeyHashs(uint selectionIndex) public view returns(bytes32[] memory)
function getSelectionInputHashs(uint selectionIndex) public view returns(bytes32[] memory)
function bytes32ToAddress(bytes32 data) public pure returns (address)
function setDepositDestinations(bytes32[] memory btcPubKeyX, bytes32[] memory btcPubKeyY, address[] memory toAddrs, address[] memory extraToAddrs, bytes32[] memory nonces, uint8[] memory v, bytes32[] memory r, bytes32[] memory s) public
function relayDepositUtxo(bytes32 txid, uint vout, uint amount, bytes memory scriptPubKey, bytes32 depositPubKeyX, bytes32 depositPubKeyY) public onlyActivated
function relayUsableUtxo(bytes32 txid, uint vout, uint amount, bytes memory scriptPubKey) public
function validateDepositUtxo(bytes32 depositKeyHash, address validator, uint8 v, bytes32 r, bytes32 s) public onlyActivated
function validateUsableUtxo(bytes32 txid, uint vout, uint amount, bytes memory scriptPubKey, address validator, uint8 v, bytes32 r, bytes32 s) public
function withdraw(uint withdrawId, address user, bytes32 tokenSummary, bytes memory destination, uint amount, bytes memory comment) public onlyActivated
function withdraw(uint withdrawId, address user, address extraUser, bytes32 tokenSummary, bytes memory destination, uint amount, bytes memory comment) public onlyActivated
function withdrawColdScript() public onlyActivated
function suggestWithdrawTx(bytes32[] memory keyHashs, bytes32[] memory inputHashs, uint outputSize, uint fee, uint change) public
function relayTxSuggest(uint suggestIndex) public
function validateSuggest(bytes32 suggestHash, uint suggestIndex, address validator, uint8 v, bytes32 r, bytes32 s) public
function relayTxSelected(uint selectionIndex) public
function validateWithdraw(uint selectionIndex, address validator, uint8[] memory v, bytes32[] memory r, bytes32[] memory s) public
Last updated