-
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-883-remove-shard_vault
- Loading branch information
Showing
55 changed files
with
1,715 additions
and
1,327 deletions.
There are no files selected for viewing
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
82 changes: 0 additions & 82 deletions
82
...worker/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/BRC20.sol
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
...er/litentry/core/assertion-build/src/dynamic/contracts/token_holding_amount/Constants.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,23 @@ | ||
// 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; | ||
|
||
library Constants { | ||
uint256 constant decimals_factor = 1000; | ||
} |
61 changes: 61 additions & 0 deletions
61
...entry/core/assertion-build/src/dynamic/contracts/token_holding_amount/GeniidataClient.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,61 @@ | ||
// 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 "../libraries/Http.sol"; | ||
import "../libraries/Utils.sol"; | ||
library GeniidataClient { | ||
function getTokenBalance( | ||
string[] memory secrets, | ||
string memory url, | ||
string memory identityString, | ||
string memory tokenName, | ||
uint8 tokenDecimals | ||
) internal returns (uint256) { | ||
string memory encodePackedUrl = string( | ||
abi.encodePacked( | ||
url, | ||
"?tick=", | ||
tokenName, | ||
"&address=", | ||
identityString | ||
) | ||
); | ||
HttpHeader[] memory headers = new HttpHeader[](1); | ||
headers[0] = HttpHeader("api-key", secrets[1]); | ||
|
||
// https://geniidata.readme.io/reference/get-brc20-tick-list-copy | ||
(bool success, string memory value) = Http.GetString( | ||
encodePackedUrl, | ||
"/data/list/0/available_balance", | ||
headers | ||
); | ||
|
||
if (success) { | ||
(bool parseDecimalSuccess, uint256 result) = Utils.parseDecimal( | ||
value, | ||
tokenDecimals | ||
); | ||
if (parseDecimalSuccess) { | ||
return result; | ||
} | ||
} | ||
return 0; | ||
} | ||
} |
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.