-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into p-895-This-Branch-Will-Not-Merged-Until-Our-D…
…ecimal-Migration-Is-Ready!
- Loading branch information
Showing
54 changed files
with
634 additions
and
194 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
63 changes: 63 additions & 0 deletions
63
tee-worker/litentry/core/assertion-build/src/dynamic/contracts/mocks/MockHttpGetI64.sol
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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright 2020-2024 Trust Computing GmbH. | ||
// This file is part of Litentry. | ||
// | ||
// Litentry is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Litentry is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Litentry. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
pragma solidity ^0.8.8; | ||
|
||
import "@openzeppelin/contracts/utils/Strings.sol"; | ||
import { HttpHeader } from "../libraries/Http.sol"; | ||
|
||
import "hardhat/console.sol"; | ||
|
||
contract MockHttpGetI64 { | ||
receive() external payable {} | ||
|
||
fallback() external payable { | ||
(string memory url, string memory jsonPointer, ) = abi.decode( | ||
msg.data, | ||
(string, string, HttpHeader[]) | ||
); | ||
|
||
bool success = true; | ||
uint256 value = 0; | ||
|
||
if ( | ||
Strings.equal( | ||
url, | ||
"https://blockchain.info/multiaddr?active=bc1pg6qjsrxwg9cvqx0gxstl0t74ynhs2528t7rp0u7acl6etwn5t6vswxrzpa&n=0" | ||
) | ||
) { | ||
// 0.1(decimal is 8) | ||
value = 10000000; | ||
} else if ( | ||
Strings.equal( | ||
url, | ||
"https://blockchain.info/multiaddr?active=bc1pqdk57wus42wuh989k3v700n6w584andwg7pvxnrd69ag3rs94cfq40qx2y&n=0" | ||
) | ||
) { | ||
value = 0; | ||
} | ||
|
||
console.log("http_get_i64>", url, jsonPointer, value); | ||
|
||
bytes memory encodedResult = abi.encode(success, value); | ||
|
||
assembly { | ||
return(add(encodedResult, 0x20), mload(encodedResult)) | ||
} | ||
} | ||
} |
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
58 changes: 58 additions & 0 deletions
58
tee-worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/Btc.sol
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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Copyright 2020-2024 Trust Computing GmbH. | ||
// This file is part of Litentry. | ||
// | ||
// Litentry is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Litentry is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Litentry. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
pragma solidity ^0.8.8; | ||
import "./Constants.sol"; | ||
import { BRC20 } from "./brc20/BRC20.sol"; | ||
library Btc { | ||
function getTokenRanges() internal pure returns (uint256[] memory) { | ||
// [0.0, 0.001, 0.1, 0.3, 0.6, 1.0, 2.0, 5.0, 10.0, 15.0, 25.0, 30.0, 40.0, 50.0]; | ||
// all ranges multiplied by decimals_factor(1000). | ||
uint256[] memory ranges = new uint256[](14); | ||
ranges[0] = 0; | ||
ranges[1] = 1; | ||
ranges[2] = 100; | ||
ranges[3] = 300; | ||
ranges[4] = 600; | ||
ranges[5] = 1000; | ||
ranges[6] = 2000; | ||
ranges[7] = 5000; | ||
ranges[8] = 10000; | ||
ranges[9] = 15000; | ||
ranges[10] = 25000; | ||
ranges[11] = 30000; | ||
ranges[12] = 40000; | ||
ranges[13] = 50000; | ||
return ranges; | ||
} | ||
|
||
function getTokenInfo() internal pure returns (TokenInfo[] memory) { | ||
uint32[] memory networks = BRC20.getDefaultTokenNetworks(); | ||
TokenInfo[] memory tokenInfoList = new TokenInfo[](networks.length); | ||
for (uint i = 0; i < networks.length; i++) { | ||
tokenInfoList[i] = TokenInfo( | ||
networks[i], | ||
"", | ||
DataProviderTypes.BlockchainInfoClient, | ||
8 | ||
); | ||
} | ||
|
||
return tokenInfoList; | ||
} | ||
} |
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
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
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.