forked from TeleportDAO/teleswap-contracts
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: initial changes based on teleswap contracts
- Loading branch information
1 parent
41f9fa4
commit 86a3b4f
Showing
54 changed files
with
1,711 additions
and
5,363 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity >=0.8.0 <0.8.4; | ||
pragma solidity 0.8.4; | ||
|
||
import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; | ||
import "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; | ||
|
||
contract BitcoinRelayProxy is TransparentUpgradeableProxy { | ||
contract BitcoinRelayProxy is ERC1967Proxy { | ||
|
||
constructor( | ||
address _logic, | ||
address admin_, | ||
bytes memory _data | ||
) payable TransparentUpgradeableProxy(_logic, admin_, _data) {} | ||
) payable ERC1967Proxy(_logic, _data) {} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,178 +1,36 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity >=0.8.0 <0.8.4; | ||
pragma solidity 0.8.4; | ||
|
||
interface IBitcoinRelay { | ||
// Structures | ||
|
||
/// @notice Structure for recording block header | ||
/// @param selfHash Hash of block header | ||
/// @param parentHash Hash of parent header | ||
/// @param merkleRoot Merkle root of transactions in the header | ||
/// @param relayer Address of Relayer who submitted the block header | ||
/// @param gasPrice Gas price of block header submission transaction | ||
struct blockHeader { | ||
bytes32 selfHash; | ||
bytes32 parentHash; | ||
bytes32 merkleRoot; | ||
address relayer; | ||
uint gasPrice; | ||
} | ||
|
||
// Events | ||
|
||
/// @notice Emits when a block header is added | ||
/// @param height of submitted header | ||
/// @param selfHash Hash of submitted header | ||
/// @param parentHash of submitted header | ||
/// @param relayer Address of Relayer who submitted the block header | ||
event BlockAdded( | ||
uint indexed height, | ||
bytes32 selfHash, | ||
bytes32 indexed parentHash, | ||
address indexed relayer | ||
); | ||
|
||
/// @notice Emits when a block header gets finalized | ||
/// @param height of the header | ||
/// @param selfHash Hash of the header | ||
/// @param parentHash of the header | ||
/// @param relayer Address of Relayer who submitted the block header | ||
/// @param rewardAmountTNT Amount of reward that the Relayer receives in target blockchain native token | ||
/// @param rewardAmountTDT Amount of reward that the Relayer receives in TeleportDAO token | ||
event BlockFinalized( | ||
uint indexed height, | ||
bytes32 selfHash, | ||
bytes32 parentHash, | ||
address indexed relayer, | ||
uint rewardAmountTNT, | ||
uint rewardAmountTDT | ||
); | ||
|
||
/// @notice Emits when inclusion of a tx is queried | ||
/// @param txId of queried transaction | ||
/// @param blockHeight of the block that includes the tx | ||
/// @param paidFee Amount of fee that user paid to Relay | ||
event NewQuery( | ||
bytes32 txId, | ||
uint blockHeight, | ||
uint paidFee | ||
); | ||
|
||
event NewRewardAmountInTDT ( | ||
uint oldRewardAmountInTDT, | ||
uint newRewardAmountInTDT | ||
); | ||
|
||
event NewFinalizationParameter ( | ||
uint oldFinalizationParameter, | ||
uint oldFinalizationParameter, | ||
uint newFinalizationParameter | ||
); | ||
|
||
event NewRelayerPercentageFee ( | ||
uint oldRelayerPercentageFee, | ||
uint newRelayerPercentageFee | ||
); | ||
|
||
event NewTeleportDAOToken( | ||
address oldTeleportDAOToken, | ||
address newTeleportDAOToken | ||
); | ||
|
||
event NewEpochLength( | ||
uint oldEpochLength, | ||
uint newEpochLength | ||
); | ||
|
||
event NewBaseQueries( | ||
uint oldBaseQueries, | ||
uint newBaseQueries | ||
); | ||
|
||
event NewSubmissionGasUsed( | ||
uint oldSubmissionGasUsed, | ||
uint newSubmissionGasUsed | ||
); | ||
|
||
// Read-only functions | ||
|
||
function relayGenesisHash() external view returns (bytes32); | ||
|
||
function initialHeight() external view returns(uint); | ||
|
||
function lastSubmittedHeight() external view returns(uint); | ||
|
||
function finalizationParameter() external view returns(uint); | ||
|
||
function TeleportDAOToken() external view returns(address); | ||
|
||
function relayerPercentageFee() external view returns(uint); | ||
|
||
function epochLength() external view returns(uint); | ||
|
||
function lastEpochQueries() external view returns(uint); | ||
|
||
function currentEpochQueries() external view returns(uint); | ||
|
||
function baseQueries() external view returns(uint); | ||
|
||
function submissionGasUsed() external view returns(uint); | ||
|
||
function getBlockHeaderHash(uint height, uint index) external view returns(bytes32); | ||
|
||
function getBlockHeaderFee(uint _height, uint _index) external view returns(uint); | ||
|
||
function getNumberOfSubmittedHeaders(uint height) external view returns (uint); | ||
|
||
function availableTDT() external view returns(uint); | ||
|
||
function availableTNT() external view returns(uint); | ||
|
||
function findHeight(bytes32 _hash) external view returns (uint256); | ||
|
||
function rewardAmountInTDT() external view returns (uint); | ||
function btcLightClient() external view returns(address); | ||
|
||
// State-changing functions | ||
|
||
function pauseRelay() external; | ||
|
||
function unpauseRelay() external; | ||
|
||
function setRewardAmountInTDT(uint _rewardAmountInTDT) external; | ||
|
||
function setFinalizationParameter(uint _finalizationParameter) external; | ||
|
||
function setRelayerPercentageFee(uint _relayerPercentageFee) external; | ||
|
||
function setTeleportDAOToken(address _TeleportDAOToken) external; | ||
|
||
function setEpochLength(uint _epochLength) external; | ||
|
||
function setBaseQueries(uint _baseQueries) external; | ||
|
||
function setSubmissionGasUsed(uint _submissionGasUsed) external; | ||
|
||
function checkTxProof( | ||
bytes32 txid, | ||
uint blockHeight, | ||
bytes calldata intermediateNodes, | ||
uint index | ||
) external payable returns (bool); | ||
|
||
function getBlockHeaderHashContract(uint _height, uint _index) external payable returns (bytes32); | ||
|
||
function addHeaders(bytes calldata _anchor, bytes calldata _headers) external returns (bool); | ||
|
||
function addHeadersWithRetarget( | ||
bytes calldata _oldPeriodStartHeader, | ||
bytes calldata _oldPeriodEndHeader, | ||
bytes calldata _headers | ||
) external returns (bool); | ||
|
||
function ownerAddHeaders(bytes calldata _anchor, bytes calldata _headers) external returns (bool); | ||
|
||
function ownerAddHeadersWithRetarget( | ||
bytes calldata _oldPeriodStartHeader, | ||
bytes calldata _oldPeriodEndHeader, | ||
bytes calldata _headers | ||
) external returns (bool); | ||
) external view returns (bool); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.