Skip to content

Commit

Permalink
add bill console doc & move map demo
Browse files Browse the repository at this point in the history
  • Loading branch information
dalaocu committed Aug 30, 2021
1 parent 5245ee0 commit a8a05a1
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
pragma solidity ^0.4.25;
import "./LibBytesMap.sol";

contract MapDemo {
contract LibBytesMapDemo {
using LibBytesMap for LibBytesMap.Map;

LibBytesMap.Map private map;

event Log(bytes key, uint256 index);

function f() public {
string memory k1 = "k1";
string memory k2 = "k2";
string memory k3 = "k3";
string memory v1 = "v1";
string memory v2 = "v2";
string memory v3 = "v3";
map.put(bytes(k1),bytes(v1));
map.put(bytes(k2),bytes(v2));
map.put(bytes(k3),bytes(v3));
map.put(bytes(k1), bytes(v1));
map.put(bytes(k2), bytes(v2));
map.put(bytes(k3), bytes(v3));

uint256 i = map.iterate_start();

while(map.can_iterate(i)){
while (map.can_iterate(i)) {
emit Log(map.getKeyByIndex(i), i);
i = map.iterate_next(i);
}
Expand Down
74 changes: 74 additions & 0 deletions docs/business_template/bill.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,80 @@ call Bill/BillController 0x9ae09665525be7affa51bac3e3cd0aa7ddefa27e endorse "BOC
call Bill/BillController 0x9ae09665525be7affa51bac3e3cd0aa7ddefa27e queryBills "BID"
```

## 控制台测试

### 部署合约
```
[group:1]> deploy BillController
transaction hash: 0x9436796448c65803c06ae15ffbbffeb34804684fea076d28390597449bec15fa
contract address: 0x37949ce7937696dafffeac91411acbbf9ed7e86b
currentAccount: 0x22fec9d7e121960e7972402789868962238d8037
```

### 函数调用
```
[group:1]> call BillController 0x37949ce7937696dafffeac91411acbbf9ed7e86b issue "BOC104,4000,12,20110102,20110106,11,11
,11,11,11,11,BBB,BID"
transaction hash: 0x355b9aea0e9f7c931d2de941f58930380a1912c662aa9a3929e3ac7ae1b41c3b
---------------------------------------------------------------------------------------------
transaction status: 0x0
description: transaction executed successfully
---------------------------------------------------------------------------------------------
Receipt message: Success
Return message: Success
Return value size:1
Return types: (INT)
Return values:(1)
---------------------------------------------------------------------------------------------
Event logs
Event: {"IssueResult":[[1]]}
[group:1]> call BillController 0x37949ce7937696dafffeac91411acbbf9ed7e86b queryBillByNo "BOC104"
transaction hash: 0xc2b2b1432aafa847df481ebaf36752124fed56c595e4fef42e2817b5059a282b
---------------------------------------------------------------------------------------------
transaction status: 0x0
description: transaction executed successfully
---------------------------------------------------------------------------------------------
Receipt message: Success
Return message: Success
Return value size:1
Return types: (STRING)
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'})
---------------------------------------------------------------------------------------------
Event logs
Event: {}
[group:1]> call BillController 0x37949ce7937696dafffeac91411acbbf9ed7e86b endorse "BOC104" "13" "AAA"
transaction hash: 0xcef2d7c74bc363b5bc7b81bbd15ba34aab5df5614f0ee47a249cfd53211796af
---------------------------------------------------------------------------------------------
transaction status: 0x0
description: transaction executed successfully
---------------------------------------------------------------------------------------------
Receipt message: Success
Return message: Success
Return value size:1
Return types: (BOOL)
Return values:(true)
---------------------------------------------------------------------------------------------
Event logs
Event: {"EndorseResult":[[true]]}
[group:1]> call BillController 0x37949ce7937696dafffeac91411acbbf9ed7e86b queryBills "BID"
transaction hash: 0x809ba2db31f8da04b53532b26430385cfd58276fe4d28c891270cbb7ba4c1ede
---------------------------------------------------------------------------------------------
transaction status: 0x0
description: transaction executed successfully
---------------------------------------------------------------------------------------------
Receipt message: Success
Return message: Success
Return value size:1
Return types: ([STRING] )
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'}] )
---------------------------------------------------------------------------------------------
Event logs
Event: {}
```

## 附 开发心得

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

0 comments on commit a8a05a1

Please sign in to comment.