-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathBridgeMock.sol
More file actions
139 lines (126 loc) · 8.38 KB
/
BridgeMock.sol
File metadata and controls
139 lines (126 loc) · 8.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;
import "./Bridge.sol";
contract BridgeMock is Bridge {
mapping(bytes32 => uint256) private amounts;
mapping(uint256 => bytes) private headers;
mapping (bytes32 => bytes) private headersByHash;
receive() external payable override {}
function registerFastBridgeBtcTransaction(
bytes memory ,
uint256 ,
bytes memory,
bytes32 derivationArgumentsHash,
bytes memory,
address payable liquidityBridgeContractAddress,
bytes memory ,
bool
) external override returns (int256) {
uint256 amount = amounts[derivationArgumentsHash];
amounts[derivationArgumentsHash] = 0;
(bool success, ) = liquidityBridgeContractAddress.call{value: amount}("");
require(success, "Sending funds failed");
return int(amount);
}
function getBtcBlockchainBlockHeaderByHeight(uint256 height) external view override returns (bytes memory) {
return headers[height];
}
function setPegin(bytes32 derivationArgumentsHash) public payable {
amounts[derivationArgumentsHash] = msg.value;
}
function setHeader(uint256 height, bytes memory header) public {
headers[height] = header;
}
function setHeaderByHash(bytes32 blockHash, bytes memory header) public {
headersByHash[blockHash] = header;
}
function getActivePowpegRedeemScript() external pure returns (bytes memory) {
bytes memory part1 = hex"522102cd53fc53a07f211641a677d250f6de99caf620e8e77071e811a28b3bcddf0be1210362634ab5";
bytes memory part2 = hex"7dae9cb373a5d536e66a8c4f67468bbcfb063809bab643072d78a1242103c5946b3fbae03a654237da86";
bytes memory part3 = hex"3c9ed534e0878657175b132b8ca630f245df04db53ae";
return abi.encodePacked(part1, part2, part3);
}
function getBtcBlockchainBestChainHeight ( ) external pure override returns (int) {return 0;}
function getStateForBtcReleaseClient ( ) external pure override returns (bytes memory) {bytes memory b; return b;}
function getStateForDebugging ( ) external pure override returns (bytes memory) {bytes memory b; return b;}
function getBtcBlockchainInitialBlockHeight ( ) external pure override returns (int) {return int(0);}
function getBtcBlockchainBlockHashAtDepth ( int256 ) external pure override returns
(bytes memory) {bytes memory b; return b;}
function getBtcTxHashProcessedHeight ( string calldata ) external pure override returns (int64) {return int64(0);}
function isBtcTxHashAlreadyProcessed ( string calldata ) external pure override returns (bool) {return false;}
function getFederationAddress ( ) external pure override returns (string memory)
{return "2N5muMepJizJE1gR7FbHJU6CD18V3BpNF9p";} // regtest genesis fed addr
function registerBtcTransaction ( bytes calldata atx, int256 height, bytes calldata pmt ) external override {}
function addSignature ( bytes calldata pubkey, bytes[] calldata signatures, bytes calldata txhash )
external override {}
function receiveHeaders ( bytes[] calldata blocks ) external override {}
function receiveHeader ( bytes calldata ) external pure override returns (int256) {return int256(0);}
function getFederationSize ( ) external pure override returns (int256) {return int256(0);}
function getFederationThreshold ( ) external pure override returns (int256) {return int256(0);}
function getFederatorPublicKey ( int256 ) external pure override returns (bytes memory)
{bytes memory b; return b;}
function getFederatorPublicKeyOfType ( int256, string calldata ) external pure
override returns (bytes memory) {bytes memory b; return b;}
function getFederationCreationTime ( ) external pure override returns (int256) {return int256(0);}
function getFederationCreationBlockNumber ( ) external pure override returns (int256) {return int256(0);}
function getRetiringFederationAddress ( ) external pure override returns (string memory) {return "";}
function getRetiringFederationSize ( ) external override pure returns (int256) {return int256(0);}
function getRetiringFederationThreshold ( ) external override pure returns (int256) {return int256(0);}
function getRetiringFederatorPublicKey ( int256 ) external override pure returns (bytes memory)
{bytes memory b; return b;}
function getRetiringFederatorPublicKeyOfType ( int256,string calldata ) external pure override
returns (bytes memory) {bytes memory b; return b;}
function getRetiringFederationCreationTime ( ) external pure override returns (int256) {return int256(0);}
function getRetiringFederationCreationBlockNumber ( ) external override pure returns
(int256) {return int256(0);}
function createFederation ( ) external pure override returns (int256) {return int256(0);}
function addFederatorPublicKey ( bytes calldata ) external pure override returns (int256)
{return int256(0);}
function addFederatorPublicKeyMultikey ( bytes calldata , bytes calldata , bytes calldata )
external pure override returns (int256) {return int256(0);}
function commitFederation ( bytes calldata ) external pure override returns (int256) {return int256(0);}
function rollbackFederation ( ) external pure override returns (int256) {return int256(0);}
function getPendingFederationHash ( ) external pure override returns (bytes memory) {bytes memory b; return b;}
function getPendingFederationSize ( ) external pure override returns (int256) {return int256(0);}
function getPendingFederatorPublicKey ( int256 ) external pure override returns (bytes memory)
{bytes memory b; return b;}
function getPendingFederatorPublicKeyOfType ( int256 , string calldata ) external pure override
returns (bytes memory) {bytes memory b; return b;}
function getLockWhitelistSize ( ) external pure override returns (int256) {return int256(0);}
function getLockWhitelistAddress ( int256 ) external pure override returns (string memory) {return "";}
function getLockWhitelistEntryByAddress ( string calldata ) external pure override returns (int256)
{return int256(0);}
function addLockWhitelistAddress ( string calldata , int256 ) external pure override returns (int256)
{return int256(0);}
function addOneOffLockWhitelistAddress ( string calldata , int256 ) external pure override returns
(int256) {return int256(0);}
function addUnlimitedLockWhitelistAddress ( string calldata ) external pure override returns (int256)
{return int256(0);}
function removeLockWhitelistAddress ( string calldata ) external pure override returns (int256)
{return int256(0);}
function setLockWhitelistDisableBlockDelay ( int256 ) external pure override returns (int256)
{return int256(0);}
function getFeePerKb ( ) external pure override returns (int256) {return int256(0);}
function voteFeePerKbChange ( int256 ) external pure override returns (int256) {return int256(0);}
function updateCollections ( ) external override {}
function getMinimumLockTxValue ( ) external pure override returns (int256) {return int256(2);}
function getBtcTransactionConfirmations ( bytes32 , bytes32, uint256 , bytes32[] calldata )
external pure override returns (int256) {return int256(2);}
function getLockingCap ( ) external pure override returns (int256) {return int256(0);}
function increaseLockingCap ( int256 ) external pure override returns (bool) {return false;}
function registerBtcCoinbaseTransaction ( bytes calldata btcTxSerialized, bytes32 blockHash, bytes
calldata pmtSerialized, bytes32 witnessMerkleRoot, bytes32 witnessReservedValue ) external override {}
function hasBtcBlockCoinbaseTransactionInformation ( bytes32 ) external pure override returns
(bool) {return false;}
function getActiveFederationCreationBlockHeight ( ) external pure override returns (uint256)
{return uint256(0);}
function getBtcBlockchainBestBlockHeader ( ) external pure override returns (bytes memory)
{bytes memory b; return b;}
function getBtcBlockchainBlockHeaderByHash(
bytes32 blockHash
) external view override returns (bytes memory) {
return headersByHash[blockHash];
}
function getBtcBlockchainParentBlockHeaderByHash ( bytes32) external pure override returns
(bytes memory) {bytes memory b; return b;}
}