Skip to content

Commit a8a05a1

Browse files
committed
add bill console doc & move map demo
1 parent 5245ee0 commit a8a05a1

File tree

2 files changed

+80
-5
lines changed

2 files changed

+80
-5
lines changed

contracts/data_structure/table/MapDemo.sol renamed to contracts/data_structure/map/LibBytesMapDemo.sol

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
pragma solidity ^0.4.25;
22
import "./LibBytesMap.sol";
33

4-
contract MapDemo {
4+
contract LibBytesMapDemo {
55
using LibBytesMap for LibBytesMap.Map;
66

77
LibBytesMap.Map private map;
88

99
event Log(bytes key, uint256 index);
10+
1011
function f() public {
1112
string memory k1 = "k1";
1213
string memory k2 = "k2";
1314
string memory k3 = "k3";
1415
string memory v1 = "v1";
1516
string memory v2 = "v2";
1617
string memory v3 = "v3";
17-
map.put(bytes(k1),bytes(v1));
18-
map.put(bytes(k2),bytes(v2));
19-
map.put(bytes(k3),bytes(v3));
18+
map.put(bytes(k1), bytes(v1));
19+
map.put(bytes(k2), bytes(v2));
20+
map.put(bytes(k3), bytes(v3));
2021

2122
uint256 i = map.iterate_start();
2223

23-
while(map.can_iterate(i)){
24+
while (map.can_iterate(i)) {
2425
emit Log(map.getKeyByIndex(i), i);
2526
i = map.iterate_next(i);
2627
}

docs/business_template/bill.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,80 @@ call Bill/BillController 0x9ae09665525be7affa51bac3e3cd0aa7ddefa27e endorse "BOC
9797
call Bill/BillController 0x9ae09665525be7affa51bac3e3cd0aa7ddefa27e queryBills "BID"
9898
```
9999

100+
## 控制台测试
101+
102+
### 部署合约
103+
```
104+
[group:1]> deploy BillController
105+
transaction hash: 0x9436796448c65803c06ae15ffbbffeb34804684fea076d28390597449bec15fa
106+
contract address: 0x37949ce7937696dafffeac91411acbbf9ed7e86b
107+
currentAccount: 0x22fec9d7e121960e7972402789868962238d8037
108+
```
109+
110+
### 函数调用
111+
```
112+
[group:1]> call BillController 0x37949ce7937696dafffeac91411acbbf9ed7e86b issue "BOC104,4000,12,20110102,20110106,11,11
113+
,11,11,11,11,BBB,BID"
114+
transaction hash: 0x355b9aea0e9f7c931d2de941f58930380a1912c662aa9a3929e3ac7ae1b41c3b
115+
---------------------------------------------------------------------------------------------
116+
transaction status: 0x0
117+
description: transaction executed successfully
118+
---------------------------------------------------------------------------------------------
119+
Receipt message: Success
120+
Return message: Success
121+
Return value size:1
122+
Return types: (INT)
123+
Return values:(1)
124+
---------------------------------------------------------------------------------------------
125+
Event logs
126+
Event: {"IssueResult":[[1]]}
127+
128+
[group:1]> call BillController 0x37949ce7937696dafffeac91411acbbf9ed7e86b queryBillByNo "BOC104"
129+
transaction hash: 0xc2b2b1432aafa847df481ebaf36752124fed56c595e4fef42e2817b5059a282b
130+
---------------------------------------------------------------------------------------------
131+
transaction status: 0x0
132+
description: transaction executed successfully
133+
---------------------------------------------------------------------------------------------
134+
Receipt message: Success
135+
Return message: Success
136+
Return value size:1
137+
Return types: (STRING)
138+
Return values:({'infoID':'BOC104','infoAmt':'4000','infoType':'12','infoIsseDate':'20110102','infoDueDate':'20110106','drwrAcct':'11','drwrCmID':'11','accptrAcct':'11','accptrCmID':'11','pyeeAcct':'11','pyeeCmID':'11','holdrAcct':'BBB','holdrCmID':'BID','waitEndorseAcct':'','waitEndorseCmID':'','rejectEndorseAcct':'','rejectEndorseCmID':'','state':'NewPublish'})
139+
---------------------------------------------------------------------------------------------
140+
Event logs
141+
Event: {}
142+
143+
[group:1]> call BillController 0x37949ce7937696dafffeac91411acbbf9ed7e86b endorse "BOC104" "13" "AAA"
144+
transaction hash: 0xcef2d7c74bc363b5bc7b81bbd15ba34aab5df5614f0ee47a249cfd53211796af
145+
---------------------------------------------------------------------------------------------
146+
transaction status: 0x0
147+
description: transaction executed successfully
148+
---------------------------------------------------------------------------------------------
149+
Receipt message: Success
150+
Return message: Success
151+
Return value size:1
152+
Return types: (BOOL)
153+
Return values:(true)
154+
---------------------------------------------------------------------------------------------
155+
Event logs
156+
Event: {"EndorseResult":[[true]]}
157+
158+
[group:1]> call BillController 0x37949ce7937696dafffeac91411acbbf9ed7e86b queryBills "BID"
159+
transaction hash: 0x809ba2db31f8da04b53532b26430385cfd58276fe4d28c891270cbb7ba4c1ede
160+
---------------------------------------------------------------------------------------------
161+
transaction status: 0x0
162+
description: transaction executed successfully
163+
---------------------------------------------------------------------------------------------
164+
Receipt message: Success
165+
Return message: Success
166+
Return value size:1
167+
Return types: ([STRING] )
168+
Return values:([{'infoID':'BOC104','infoAmt':'4000','infoType':'12','infoIsseDate':'20110102','infoDueDate':'20110106','drwrAcct':'11','drwrCmID':'11','accptrAcct':'11','accptrCmID':'11','pyeeAcct':'11','pyeeCmID':'11','holdrAcct':'BBB','holdrCmID':'BID','waitEndorseAcct':'AAA','waitEndorseCmID':'13','rejectEndorseAcct':'','rejectEndorseCmID':'','state':'EndorseWaitSign'}] )
169+
---------------------------------------------------------------------------------------------
170+
Event logs
171+
Event: {}
172+
```
173+
100174
## 附 开发心得
101175

102176
开发过程中,最主要是对整个票据流程的梳理,针对各个方法的开发,其实并不是很难,只是对过程的一种描述。

0 commit comments

Comments
 (0)