Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #93

Merged
merged 37 commits into from
Aug 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
c1d03c4
update langres
Waisevi Jun 25, 2019
e32630b
Autobuild N.601 [ci skip]
Jun 25, 2019
cd55b52
Added new System
syypoo Jul 8, 2019
6aeca27
Autobuild N.602 [ci skip]
Jul 8, 2019
bf5e8c7
Switching users identification to wallet addresses instead of Key IDs
Jul 18, 2019
0507c3b
Autobuild N.603 [ci skip]
Jul 18, 2019
ed16923
Switching Key IDs to wallet addresses for Voting wizard
Jul 21, 2019
db3d2a2
Autobuild N.604 [ci skip]
Jul 21, 2019
877ade6
File validator added to upload_page
Jul 23, 2019
d5a8f5a
Autobuild N.605 [ci skip]
Jul 23, 2019
1e39ff3
Moving back to Key IDs for Voting for Validators
Jul 24, 2019
d050560
Autobuild N.606 [ci skip]
Jul 24, 2019
4422b9f
Recovery of system contracts
syypoo Jul 29, 2019
feefdc6
Autobuild N.607 [ci skip]
Jul 29, 2019
342879c
Recovery of system pages
syypoo Jul 29, 2019
2a28b76
Autobuild N.608 [ci skip]
Jul 29, 2019
05c2246
Recovery of basic contracts
syypoo Jul 29, 2019
23eca53
Autobuild N.609 [ci skip]
Jul 29, 2019
4041a6d
Preparations for Consortium Network
Jul 29, 2019
d27c42f
Autobuild N.610 [ci skip]
Jul 29, 2019
435eacd
Converting database requests to a valid JSON
Jul 31, 2019
4b7d01d
Autobuild N.611 [ci skip]
Jul 31, 2019
bf15a75
Filenames and variables renaming
Jul 31, 2019
3047487
Autobuild N.612 [ci skip]
Jul 31, 2019
8d1fb29
Adding Sidechain Node role
Aug 1, 2019
8a5180e
Autobuild N.613 [ci skip]
Aug 1, 2019
694088b
upp langress
Waisevi Aug 2, 2019
0f28c50
Autobuild N.614 [ci skip]
Aug 2, 2019
3032a45
Update members_list_admin.ptl
Waisevi Aug 5, 2019
4f5e190
Autobuild N.615 [ci skip]
Aug 5, 2019
d305236
update
Waisevi Aug 9, 2019
c3f1931
Autobuild N.616 [ci skip]
Aug 9, 2019
f97381a
Switching users identification to wallet addresses instead of Key IDs…
Aug 15, 2019
3a647e4
Autobuild N.617 [ci skip]
Aug 15, 2019
3cc1901
Bug fixes
Aug 18, 2019
532fe67
Autobuild N.618 [ci skip]
Aug 18, 2019
efa0b9d
Merge branch 'new_accounts' into develop
syypoo Aug 21, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
368 changes: 184 additions & 184 deletions basic.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion conditions.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
{
"Name": "full_nodes",
"Conditions": "ContractConditions(\"@1DeveloperCondition\")",
"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}",
"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}",
"Type": "contracts"
},
{
Expand Down
34 changes: 17 additions & 17 deletions ecosystem_apps/crediting.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions ecosystem_apps/crediting/contracts/CreditingAdd.sim
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ contract CreditingAdd {
$check_access = AppParam(Int($app), "crediting_borrower_role", $ecosystem_id)
var rids array
rids = JSONDecode("["+$check_access+"]")
if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->member_id": $key_id, "deleted": 0}).Row() {
if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->account": $account_id, "deleted": 0}).Row() {
warning LangRes("@1access_denied", "en")
}

Expand All @@ -75,7 +75,7 @@ contract CreditingAdd {

//check borrower
if Int($Id) > 0 {
if AddressToId(borrower) != $key_id {
if borrower != $account_id {
warning LangRes("@1access_denied", "en")
}
}
Expand All @@ -95,7 +95,7 @@ contract CreditingAdd {
action {
var m map
if Int($Id) == 0 {
m["borrower"] = IdToAddress($key_id)
m["borrower"] = $account_id
m["status"] = 0
m["deleted"] = 0
m["date_created"] = $block_time
Expand Down
15 changes: 7 additions & 8 deletions ecosystem_apps/crediting/contracts/CreditingBid.sim
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ contract CreditingBid {

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

func sendNotesNewBid() {
var i int subs_arr array
$KeyId = IdToAddress($key_id)
subs_arr = DBFind("crediting_subs").Columns("creditor").Limit(10000).Where({"creditor": {"$neq": $KeyId}, "request_id": $RequestId, "deleted": 0})
subs_arr = DBFind("crediting_subs").Where({"creditor": {"$neq": $account_id}, "request_id": $RequestId, "deleted": 0}).Columns("creditor").Limit(10000)
while i < Len(subs_arr) {
var sub_map memberId int
var sub_map int memberAccount string
sub_map = subs_arr[i]
memberId = AddressToId(sub_map["creditor"])
memberAccount = sub_map["creditor"]

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

Expand All @@ -59,7 +58,7 @@ contract CreditingBid {
sendNotesNewBid()

var m map
m["creditor"] = IdToAddress($key_id)
m["creditor"] = $account_id
m["date_created"] = $block_time
m["rate"] = $Rate
m["request_id"] = $RequestId
Expand Down
2 changes: 1 addition & 1 deletion ecosystem_apps/crediting/contracts/CreditingBlock.sim
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ contract CreditingBlock {
$check_access = AppParam(Int($app), "crediting_admin_role", $ecosystem_id)
var rids array
rids = JSONDecode("["+$check_access+"]")
if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->member_id": $key_id, "deleted": 0}).Row() {
if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->account": $account_id, "deleted": 0}).Row() {
warning LangRes("@1access_denied", "en")
}
}
Expand Down
2 changes: 1 addition & 1 deletion ecosystem_apps/crediting/contracts/CreditingDel.sim
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ contract CreditingDel {
}

//check borrower
if AddressToId(borrower) != $key_id {
if borrower != $account_id {
warning LangRes("@1access_denied", "en")
}
}
Expand Down
14 changes: 6 additions & 8 deletions ecosystem_apps/crediting/contracts/CreditingSignAccept.sim
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ contract CreditingSignAccept {

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

//check borrower && creditor
if AddressToId($borrower) != $key_id && AddressToId($creditor) != $key_id {
if $borrower != $account_id && $creditor != $account_id {
warning LangRes("@1access_denied", "en")
}

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

action {
closeMyNotes()

var m map
if AddressToId($borrower) == $key_id && $sign_borrower == 0 {
if $borrower == $account_id && $sign_borrower == 0 {
m["sign_borrower"] = $block_time
m["pub_borrower"] = $pub
$sign_borrower = $block_time

var memberId int
var header body string params map
memberId = AddressToId($creditor)
header = "Signature for auction №" + Str($Id)
body = "Your signature is required!"
params["crediting_id"] = $Id
@1NotificationsSend("MemberId,Sender,Icon,Header,Body,Page,Params", memberId, 1, "fa-edit", header, body, "crediting_view", params)
} elif AddressToId($creditor) == $key_id && $sign_creditor == 0 {
@1NotificationsSend("MemberAccount,Sender,Icon,Header,Body,Page,Params", $creditor, 1, "fa-edit", header, body, "crediting_view", params)
} elif $creditor == $account_id && $sign_creditor == 0 {
m["sign_creditor"] = $block_time
m["pub_creditor"] = $pub
$sign_creditor = $block_time
Expand Down
4 changes: 2 additions & 2 deletions ecosystem_apps/crediting/contracts/CreditingSignReject.sim
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ contract CreditingSignReject {

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

//check borrower && creditor
if AddressToId($borrower) != $key_id && AddressToId($creditor) != $key_id {
if $borrower != $account_id && $creditor != $account_id {
warning LangRes("@1access_denied", "en")
}
}
Expand Down
25 changes: 12 additions & 13 deletions ecosystem_apps/crediting/contracts/CreditingStatusUpdate.sim
Original file line number Diff line number Diff line change
Expand Up @@ -14,51 +14,50 @@ contract CreditingStatusUpdate {
offer_date = offers["date_created"]
DBUpdate("crediting_requests", request_id, {"creditor": creditor, "rate": rate, "offer_id": offer_id, "offer_date": offer_date})

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

func sendNotesAuctionStarted(request map) {
var request_id i int subs_arr array
request_id = Int(request["id"])
subs_arr = DBFind("crediting_subs").Columns("creditor").Limit(10000).Where({"request_id": request_id, "deleted": 0})
subs_arr = DBFind("crediting_subs").Where({"request_id": request_id, "deleted": 0}).Columns("creditor").Limit(10000)
while i < Len(subs_arr) {
var sub_map memberId int
var sub_map int memberAccount string
sub_map = subs_arr[i]
memberId = AddressToId(sub_map["creditor"])
memberAccount = sub_map["creditor"]

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

func sendNotesAuctionFinished(request map) {
var request_id i int subs_arr array
request_id = Int(request["id"])
subs_arr = DBFind("crediting_subs").Columns("creditor").Limit(10000).Where({"request_id": request_id, "deleted": 0})
subs_arr = DBFind("crediting_subs").Where({"request_id": request_id, "deleted": 0}).Columns("creditor").Limit(10000)
while i < Len(subs_arr) {
var sub_map memberId int
var sub_map int memberAccount string
sub_map = subs_arr[i]
memberId = AddressToId(sub_map["creditor"])
memberAccount = sub_map["creditor"]

var header body string params map
header = "Auction №" + Str(request_id) + " finished"
body = "You can't bid anymore!"
params["crediting_id"] = request_id
params["optional"] = 1
@1NotificationsSend("MemberId,Sender,Icon,Header,Body,Page,Params", memberId, 1, "fa-close", header, body, "crediting_view", params)
@1NotificationsSend("MemberAccount,Sender,Icon,Header,Body,Page,Params", memberAccount, 1, "fa-close", header, body, "crediting_view", params)
i = i + 1
}
}
Expand Down Expand Up @@ -97,7 +96,7 @@ contract CreditingStatusUpdate {
$check_access = AppParam(Int($app), "crediting_admin_role", $ecosystem_id)
var rids array
rids = JSONDecode("["+$check_access+"]")
if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->member_id": $key_id, "deleted": 0}).Row() {
if !DBFind("@1roles_participants").Where({"ecosystem": $ecosystem_id, "role->id": {"$in": rids}, "member->account": $account_id, "deleted": 0}).Row() {
warning LangRes("@1access_denied", "en")
}
}
Expand Down
5 changes: 2 additions & 3 deletions ecosystem_apps/crediting/contracts/CreditingSubscribe.sim
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ contract CreditingSubscribe {
}

conditions {
$KeyId = IdToAddress($key_id)
$request = DBFind("crediting_subs").Where({"request_id": $Id, "creditor": $KeyId, "deleted": 0}).One("id")
$request = DBFind("crediting_subs").Where({"request_id": $Id, "creditor": $account_id, "deleted": 0}).One("id")
}

action {
Expand All @@ -15,7 +14,7 @@ contract CreditingSubscribe {
DBUpdate("crediting_subs", Int($request), m)
} else {
m["request_id"] = $Id
m["creditor"] = $KeyId
m["creditor"] = $account_id
DBInsert("crediting_subs", m)
}
}
Expand Down
2 changes: 1 addition & 1 deletion ecosystem_apps/crediting/languages/crediting_settings.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"en": "Crediting settings", "ru": "Настройки Кридитования"}
{"en": "Crediting settings", "ru": "Настройки Кредитования"}
6 changes: 3 additions & 3 deletions ecosystem_apps/crediting/pages/crediting_add.ptl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
DBFind(@1applications).Where({"ecosystem": #ecosystem_id#, "name": "Crediting"}).Columns("name,id").Vars(application)
DBFind("@1applications").Where({"ecosystem": "#ecosystem_id#", "name": "Crediting"}).Columns("name,id").Vars(application)
If(#Id#>0){
DBFind(crediting_requests).Where({"id": #Id#}).Vars(request)
DBFind("crediting_requests").Where({"id": "#Id#"}).Vars(request)
}
Form(){
Div(list-group-item){
Expand All @@ -12,7 +12,7 @@ Form(){
}
}
Div(col-md-9 text-left){
SetVar(borrower, Address(#key_id#))
SetVar(borrower, #account_id#)
Input(Name: Borrower, Disabled: 1, Value: #borrower#)
}
}
Expand Down
7 changes: 3 additions & 4 deletions ecosystem_apps/crediting/pages/crediting_history.ptl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
DBFind(crediting_offers, offers).Where({"request_id": #Id#}).Order({"rate": 1, "date_created": 1}).Custom(custom_creditor){
SetVar(creditor_id, AddressToId(#creditor#))
DBFind(@1members).Where({"ecosystem": #ecosystem_id#, "id": #creditor_id#}).Columns("member_info->information").Vars(c)
LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_key_id=#c_id#"){
DBFind("crediting_offers", offers).Where({"request_id": "#Id#"}).Order({"rate": 1, "date_created": 1}).Custom(custom_creditor){
DBFind("@1members").Where({"ecosystem": "#ecosystem_id#", "account": "#creditor#"}).Columns("member_info->information").Vars(c)
LinkPage(Class: text-primary h5 text-bold, Page: @1profile_view, PageParams: "v_account=#c_account#"){
Div(){
Span(Em(Class: fa icon-user fa-2x)).Style(margin-right:10px;)
Span(){
Expand Down
Loading