Skip to content

Commit a68afb9

Browse files
committed
feat: Add smart-contract code
Signed-off-by: yashrajdesai <yashrajdesai30@gmail.com>
1 parent d6ab376 commit a68afb9

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
pragma solidity >=0.7.0 <0.9.0;
3+
4+
contract Transaction {
5+
address public serviceContractAddress;
6+
7+
// Initializing service contract address in constructor
8+
constructor() {
9+
serviceContractAddress = 0xA6Abc17819738299B3B2c1CE46d55c74f04E290C;
10+
}
11+
12+
// Queries the balance in _asset of an Iroha _account
13+
function getAccountTransactions(string memory _account, string memory _pageSize, string memory _firstTxHash, string memory _firstTxTime, string memory _lastTxTime, string memory _firstTxHeight, string memory _lastTxHeight, string memory _ordering) public returns (bytes memory result) {
14+
bytes memory payload = abi.encodeWithSignature(
15+
"getAccountTransactions(string,string,string,string,string,string,string,string)",
16+
_account,
17+
_pageSize,
18+
_firstTxHash,
19+
_firstTxTime,
20+
_lastTxTime,
21+
_firstTxHeight,
22+
_lastTxHeight,
23+
_ordering);
24+
(bool success, bytes memory ret) = address(serviceContractAddress).delegatecall(payload);
25+
require(success, "Error calling service contract function");
26+
result = ret;
27+
}
28+
29+
function getAccountAssetTransactions(string memory _account, string memory _asset, string memory _pageSize, string memory _firstTxHash, string memory _firstTxTime, string memory _lastTxTime, string memory _firstTxHeight, string memory _lastTxHeight, string memory _ordering) public returns (bytes memory result) {
30+
bytes memory payload = abi.encodeWithSignature(
31+
"getAccountAssetTransactions(string,string,string,string,string,string,string,string,string)",
32+
_account,
33+
_asset,
34+
_pageSize,
35+
_firstTxHash,
36+
_firstTxTime,
37+
_lastTxTime,
38+
_firstTxHeight,
39+
_lastTxHeight,
40+
_ordering);
41+
(bool success, bytes memory ret) = address(serviceContractAddress).delegatecall(payload);
42+
require(success, "Error calling service contract function");
43+
result = ret;
44+
}
45+
function getPendingTransactions(string memory _pageSize, string memory _firstTxHash, string memory _firstTxTime, string memory _lastTxTime, string memory _ordering) public returns (bytes memory result) {
46+
bytes memory payload = abi.encodeWithSignature(
47+
"getPendingTransactions(string,string,string,string,string)",
48+
_pageSize,
49+
_firstTxHash,
50+
_firstTxTime,
51+
_lastTxTime,
52+
_ordering);
53+
(bool success, bytes memory ret) = address(serviceContractAddress).delegatecall(payload);
54+
require(success, "Error calling service contract function");
55+
result = ret;
56+
}
57+
58+
function getTransactions(string memory hash) public returns (bytes memory result) {
59+
bytes memory payload = abi.encodeWithSignature(
60+
"getTransactions(string)",
61+
hash);
62+
(bool success, bytes memory ret) = address(serviceContractAddress).delegatecall(payload);
63+
require(success, "Error calling service contract function");
64+
result = ret;
65+
}
66+
}

0 commit comments

Comments
 (0)