Skip to content

Commit e59e5fa

Browse files
authored
Merge pull request #93 from AplaProject/develop
Develop
2 parents 9fa87dc + efa0b9d commit e59e5fa

File tree

437 files changed

+5623
-4988
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

437 files changed

+5623
-4988
lines changed

basic.json

Lines changed: 184 additions & 184 deletions
Large diffs are not rendered by default.

conditions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
{
5454
"Name": "full_nodes",
5555
"Conditions": "ContractConditions(\"@1DeveloperCondition\")",
56-
"Value": "contract full_nodes {\n data {\n Value string\n }\n\n conditions {\n if Size($Value) == 0 {\n warning \"Value was not received\"\n }\n\n var full_nodes_arr array\n full_nodes_arr = JSONDecode($Value)\n\n var len_arr int\n len_arr = Len(full_nodes_arr)\n\n if len_arr == 0 {\n warning \"Wrong array structure\"\n }\n\n var i int\n while(i < len_arr){\n var node_map map\n node_map = full_nodes_arr[i]\n\n var public_key string\n var tcp_address string\n var api_address string\n var key_id string\n\n public_key = node_map[\"public_key\"]\n tcp_address = node_map[\"tcp_address\"]\n api_address = node_map[\"api_address\"]\n key_id = node_map[\"key_id\"]\n\n if Size(public_key) == 0 {\n warning \"Public key was not received\"\n }\n if Size(tcp_address) == 0 {\n warning \"TCP address was not received\"\n }\n if Size(api_address) == 0 {\n warning \"API address was not received\"\n }\n if Size(key_id) == 0 {\n warning \"Key ID was not received\"\n }\n\n i = i + 1\n }\n }\n}",
56+
"Value": "contract full_nodes {\n data {\n Value string\n }\n\n conditions {\n if Size($Value) == 0 {\n warning \"Value was not received\"\n }\n\n var full_nodes_arr array\n full_nodes_arr = JSONDecode($Value)\n\n var len_arr int\n len_arr = Len(full_nodes_arr)\n\n if len_arr == 0 {\n warning \"Wrong array structure\"\n }\n\n var i int\n while(i < len_arr){\n var node_map map\n node_map = full_nodes_arr[i]\n\n var public_key string\n var tcp_address string\n var api_address string\n var key_id string\n\n public_key = node_map[\"public_key\"]\n tcp_address = node_map[\"tcp_address\"]\n api_address = node_map[\"api_address\"]\n key_id = node_map[\"key_id\"]\n\n if Size(public_key) == 0 {\n warning \"Public key was not received\"\n }\n if Size(tcp_address) == 0 {\n warning \"TCP address was not received\"\n }\n if Size(api_address) == 0 {\n warning \"API address was not received\"\n }\n if Size(key_id) == 0 {\n warning \"Account was not received\"\n }\n\n i = i + 1\n }\n }\n}",
5757
"Type": "contracts"
5858
},
5959
{

ecosystem_apps/crediting.json

Lines changed: 17 additions & 17 deletions
Large diffs are not rendered by default.

ecosystem_apps/crediting/contracts/CreditingAdd.sim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ contract CreditingAdd {
5959
$check_access = AppParam(Int($app), "crediting_borrower_role", $ecosystem_id)
6060
var rids array
6161
rids = JSONDecode("["+$check_access+"]")
62-
if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->member_id": $key_id, "deleted": 0}).Row() {
62+
if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->account": $account_id, "deleted": 0}).Row() {
6363
warning LangRes("@1access_denied", "en")
6464
}
6565

@@ -75,7 +75,7 @@ contract CreditingAdd {
7575

7676
//check borrower
7777
if Int($Id) > 0 {
78-
if AddressToId(borrower) != $key_id {
78+
if borrower != $account_id {
7979
warning LangRes("@1access_denied", "en")
8080
}
8181
}
@@ -95,7 +95,7 @@ contract CreditingAdd {
9595
action {
9696
var m map
9797
if Int($Id) == 0 {
98-
m["borrower"] = IdToAddress($key_id)
98+
m["borrower"] = $account_id
9999
m["status"] = 0
100100
m["deleted"] = 0
101101
m["date_created"] = $block_time

ecosystem_apps/crediting/contracts/CreditingBid.sim

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ contract CreditingBid {
66

77
func closeMyNotes() {
88
var notes array i int
9-
notes = DBFind("@1notifications").Where({"closed": 0, "ecosystem": $ecosystem_id, "recipient->member_id": $key_id, "page_name": "crediting_view", "page_params->crediting_id": $RequestId})
9+
notes = DBFind("@1notifications").Where({"closed": 0, "ecosystem": $ecosystem_id, "recipient->account": $account_id, "page_name": "crediting_view", "page_params->crediting_id": $RequestId})
1010
while i < Len(notes){
1111
var note map
1212
note = notes[i]
@@ -17,19 +17,18 @@ contract CreditingBid {
1717

1818
func sendNotesNewBid() {
1919
var i int subs_arr array
20-
$KeyId = IdToAddress($key_id)
21-
subs_arr = DBFind("crediting_subs").Columns("creditor").Limit(10000).Where({"creditor": {"$neq": $KeyId}, "request_id": $RequestId, "deleted": 0})
20+
subs_arr = DBFind("crediting_subs").Where({"creditor": {"$neq": $account_id}, "request_id": $RequestId, "deleted": 0}).Columns("creditor").Limit(10000)
2221
while i < Len(subs_arr) {
23-
var sub_map memberId int
22+
var sub_map int memberAccount string
2423
sub_map = subs_arr[i]
25-
memberId = AddressToId(sub_map["creditor"])
24+
memberAccount = sub_map["creditor"]
2625

2726
var header body string params map
2827
header = "New bid on auction №" + Str($RequestId)
2928
body = "Check auction for information"
3029
params["crediting_id"] = $RequestId
3130
params["optional"] = 1
32-
@1NotificationsSend("MemberId,Sender,Icon,Header,Body,Page,Params", memberId, 1, "fa-fire", header, body, "crediting_view", params)
31+
@1NotificationsSend("MemberAccount,Sender,Icon,Header,Body,Page,Params", memberAccount, 1, "fa-fire", header, body, "crediting_view", params)
3332
i = i + 1
3433
}
3534
}
@@ -40,7 +39,7 @@ contract CreditingBid {
4039
$check_access = AppParam(Int($app), "crediting_creditor_role", $ecosystem_id)
4140
var rids array
4241
rids = JSONDecode("["+$check_access+"]")
43-
if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->member_id": $key_id, "deleted": 0}).Row() {
42+
if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->account": $account_id, "deleted": 0}).Row() {
4443
warning LangRes("@1access_denied", "en")
4544
}
4645

@@ -59,7 +58,7 @@ contract CreditingBid {
5958
sendNotesNewBid()
6059

6160
var m map
62-
m["creditor"] = IdToAddress($key_id)
61+
m["creditor"] = $account_id
6362
m["date_created"] = $block_time
6463
m["rate"] = $Rate
6564
m["request_id"] = $RequestId

ecosystem_apps/crediting/contracts/CreditingBlock.sim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ contract CreditingBlock {
99
$check_access = AppParam(Int($app), "crediting_admin_role", $ecosystem_id)
1010
var rids array
1111
rids = JSONDecode("["+$check_access+"]")
12-
if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->member_id": $key_id, "deleted": 0}).Row() {
12+
if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->account": $account_id, "deleted": 0}).Row() {
1313
warning LangRes("@1access_denied", "en")
1414
}
1515
}

ecosystem_apps/crediting/contracts/CreditingDel.sim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ contract CreditingDel {
1515
}
1616

1717
//check borrower
18-
if AddressToId(borrower) != $key_id {
18+
if borrower != $account_id {
1919
warning LangRes("@1access_denied", "en")
2020
}
2121
}

ecosystem_apps/crediting/contracts/CreditingSignAccept.sim

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ contract CreditingSignAccept {
55

66
func closeMyNotes() {
77
var notes array i int
8-
notes = DBFind("@1notifications").Where({"closed": 0, "ecosystem": $ecosystem_id, "recipient->member_id": $key_id, "page_name": "crediting_view", "page_params->crediting_id": $Id})
8+
notes = DBFind("@1notifications").Where({"closed": 0, "ecosystem": $ecosystem_id, "recipient->account": $account_id, "page_name": "crediting_view", "page_params->crediting_id": $Id})
99
while i < Len(notes){
1010
var note map
1111
note = notes[i]
@@ -32,31 +32,29 @@ contract CreditingSignAccept {
3232
}
3333

3434
//check borrower && creditor
35-
if AddressToId($borrower) != $key_id && AddressToId($creditor) != $key_id {
35+
if $borrower != $account_id && $creditor != $account_id {
3636
warning LangRes("@1access_denied", "en")
3737
}
3838

39-
$pub = DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "id": $key_id}).One("pub")
39+
$pub = DBFind("@1keys").Where({"ecosystem": $ecosystem_id, "account": $account_id, "deleted": 0}).One("pub")
4040
$pub = PubToHex($pub)
4141
}
4242

4343
action {
4444
closeMyNotes()
4545

4646
var m map
47-
if AddressToId($borrower) == $key_id && $sign_borrower == 0 {
47+
if $borrower == $account_id && $sign_borrower == 0 {
4848
m["sign_borrower"] = $block_time
4949
m["pub_borrower"] = $pub
5050
$sign_borrower = $block_time
5151

52-
var memberId int
5352
var header body string params map
54-
memberId = AddressToId($creditor)
5553
header = "Signature for auction №" + Str($Id)
5654
body = "Your signature is required!"
5755
params["crediting_id"] = $Id
58-
@1NotificationsSend("MemberId,Sender,Icon,Header,Body,Page,Params", memberId, 1, "fa-edit", header, body, "crediting_view", params)
59-
} elif AddressToId($creditor) == $key_id && $sign_creditor == 0 {
56+
@1NotificationsSend("MemberAccount,Sender,Icon,Header,Body,Page,Params", $creditor, 1, "fa-edit", header, body, "crediting_view", params)
57+
} elif $creditor == $account_id && $sign_creditor == 0 {
6058
m["sign_creditor"] = $block_time
6159
m["pub_creditor"] = $pub
6260
$sign_creditor = $block_time

ecosystem_apps/crediting/contracts/CreditingSignReject.sim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ contract CreditingSignReject {
55

66
func closeMyNotes() {
77
var notes array i int
8-
notes = DBFind("@1notifications").Where({"closed": 0, "ecosystem": $ecosystem_id, "recipient->member_id": $key_id, "page_name": "crediting_view", "page_params->crediting_id": $Id})
8+
notes = DBFind("@1notifications").Where({"closed": 0, "ecosystem": $ecosystem_id, "recipient->account": $account_id, "page_name": "crediting_view", "page_params->crediting_id": $Id})
99
while i < Len(notes){
1010
var note map
1111
note = notes[i]
@@ -27,7 +27,7 @@ contract CreditingSignReject {
2727
}
2828

2929
//check borrower && creditor
30-
if AddressToId($borrower) != $key_id && AddressToId($creditor) != $key_id {
30+
if $borrower != $account_id && $creditor != $account_id {
3131
warning LangRes("@1access_denied", "en")
3232
}
3333
}

ecosystem_apps/crediting/contracts/CreditingStatusUpdate.sim

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,51 +14,50 @@ contract CreditingStatusUpdate {
1414
offer_date = offers["date_created"]
1515
DBUpdate("crediting_requests", request_id, {"creditor": creditor, "rate": rate, "offer_id": offer_id, "offer_date": offer_date})
1616

17-
var memberId int
18-
var header body string params map
19-
memberId = AddressToId(request["borrower"])
17+
var header body memberAccount string params map
18+
memberAccount = request["borrower"]
2019
header = "Signature for auction №" + Str(request_id)
2120
body = "Your signature is required!"
2221
params["crediting_id"] = request_id
23-
@1NotificationsSend("MemberId,Sender,Icon,Header,Body,Page,Params", memberId, 1, "fa-edit", header, body, "crediting_view", params)
22+
@1NotificationsSend("MemberAccount,Sender,Icon,Header,Body,Page,Params", memberAccount, 1, "fa-edit", header, body, "crediting_view", params)
2423
}
2524
return offer_id
2625
}
2726

2827
func sendNotesAuctionStarted(request map) {
2928
var request_id i int subs_arr array
3029
request_id = Int(request["id"])
31-
subs_arr = DBFind("crediting_subs").Columns("creditor").Limit(10000).Where({"request_id": request_id, "deleted": 0})
30+
subs_arr = DBFind("crediting_subs").Where({"request_id": request_id, "deleted": 0}).Columns("creditor").Limit(10000)
3231
while i < Len(subs_arr) {
33-
var sub_map memberId int
32+
var sub_map int memberAccount string
3433
sub_map = subs_arr[i]
35-
memberId = AddressToId(sub_map["creditor"])
34+
memberAccount = sub_map["creditor"]
3635

3736
var header body string params map
3837
header = "Auction №" + Str(request_id) + " started"
3938
body = "You can bid now!"
4039
params["crediting_id"] = request_id
4140
params["optional"] = 1
42-
@1NotificationsSend("MemberId,Sender,Icon,Header,Body,Page,Params", memberId, 1, "fa-check", header, body, "crediting_view", params)
41+
@1NotificationsSend("MemberAccount,Sender,Icon,Header,Body,Page,Params", memberAccount, 1, "fa-check", header, body, "crediting_view", params)
4342
i = i + 1
4443
}
4544
}
4645

4746
func sendNotesAuctionFinished(request map) {
4847
var request_id i int subs_arr array
4948
request_id = Int(request["id"])
50-
subs_arr = DBFind("crediting_subs").Columns("creditor").Limit(10000).Where({"request_id": request_id, "deleted": 0})
49+
subs_arr = DBFind("crediting_subs").Where({"request_id": request_id, "deleted": 0}).Columns("creditor").Limit(10000)
5150
while i < Len(subs_arr) {
52-
var sub_map memberId int
51+
var sub_map int memberAccount string
5352
sub_map = subs_arr[i]
54-
memberId = AddressToId(sub_map["creditor"])
53+
memberAccount = sub_map["creditor"]
5554

5655
var header body string params map
5756
header = "Auction №" + Str(request_id) + " finished"
5857
body = "You can't bid anymore!"
5958
params["crediting_id"] = request_id
6059
params["optional"] = 1
61-
@1NotificationsSend("MemberId,Sender,Icon,Header,Body,Page,Params", memberId, 1, "fa-close", header, body, "crediting_view", params)
60+
@1NotificationsSend("MemberAccount,Sender,Icon,Header,Body,Page,Params", memberAccount, 1, "fa-close", header, body, "crediting_view", params)
6261
i = i + 1
6362
}
6463
}
@@ -97,7 +96,7 @@ contract CreditingStatusUpdate {
9796
$check_access = AppParam(Int($app), "crediting_admin_role", $ecosystem_id)
9897
var rids array
9998
rids = JSONDecode("["+$check_access+"]")
100-
if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->member_id": $key_id, "deleted": 0}).Row() {
99+
if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->account": $account_id, "deleted": 0}).Row() {
101100
warning LangRes("@1access_denied", "en")
102101
}
103102
}

0 commit comments

Comments
 (0)