Skip to content

Commit 0cee834

Browse files
committed
Release v1.2.0
1 parent 30a1eac commit 0cee834

File tree

115 files changed

+2133
-857
lines changed

Some content is hidden

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

115 files changed

+2133
-857
lines changed

basic.json

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

lang_res.json

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

other/tokens_sale.json

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

other/tokens_sale/blocks/ts_contract_investors.ptl

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,19 @@ Div(list-group-item mt-lg mb-lg ml-lg mr-lg){
33
Div(Class: h3 text-bold m0 text-center, Body: the KYC screening at SnapSwap International S.A.)
44

55
Div(Class: h4 mt-xl, Body: Em(Date: 1st of November 2018))
6-
Div(Class: h4, Body: Em(Re: Invitation to submit purchase orders to buy APL Tokens))
6+
Div(Class: h4, Body: Em(Re: Invitation to submit purchase orders to buy APLA Tokens))
77

88
Div(Class: h4 mt-xl, Body: Dear Apla User,)
99
Div(Class: h4, Body: We are very delighted that you have chosen the Apla blockchain platform to build decentralised applications, create ecosystems and accommodate your other business needs.)
10-
Div(Class: h4, Body: According to Article 8.1 of the Apla General Terms and Conditions (link to the site), EGAAS S.A. will be charging a license fee for each transaction signed by Apla users on the platform. The license fee is payable in the internal virtual currency of the Apla platform ecosystem named APL tokens. Hence, in order to use the platform, you will need to have APL tokens on your APL Wallet prior to signing each transaction.)
11-
Div(Class: h4, Body: EGAAS S.A. will be conducting an initial sale of APL Tokens from November 2018 until July 2019. The commercial terms of the sale are summarised below:)
12-
Div(row){
13-
Div(col-sm-12 text-center){
14-
Button(Class: btn-xs btn-link, Page: ts_commercial_terms){
15-
Span(Class: h4, Body: The commercial terms)
16-
}.Popup(70, The commercial terms)
17-
}
10+
Div(Class: h4, Body: According to Article 8.1 of the Apla General Terms and Conditions (Span(Class: text-primary, Body: www.apla.io)), EGAAS S.A. will be charging a license fee for each transaction signed by Apla users on the platform. The license fee is payable in the internal virtual currency of the Apla platform ecosystem named APLA tokens. Hence, in order to use the platform, you will need to have APLA tokens on your APLA Wallet prior to signing each transaction.)
11+
Div(Class: h4){
12+
Span(EGAAS S.A. will be conducting an initial sale of APLA Tokens from November 2018 until July 2019. The commercial terms of the sale are summarised below:)
13+
Button(Class: btn-xs btn-link, Page: ts_commercial_terms){
14+
Span(Class: h4, Body: The commercial terms)
15+
}.Popup(70, The commercial terms)
1816
}
1917

20-
Div(Class: h4, Body: Please submit your purchase order to buy APL tokens after you have reviewed and agreed with the legal terms of sale.)
18+
Div(Class: h4, Body: Please submit your purchase order to buy APLA tokens after you have reviewed and agreed with the legal terms of sale.)
2119
Div(Class: h4, Body: After we have received your purchase order, we will send you an invoice for making the payment of the purchase price.)
2220
Div(Class: h4, Body: Please reach out to us via the email Span(Class: text-primary, Body: [email protected]) if you have any questions or require any clarification of the above terms. We’ll also give you an access to the online data room with all information and legal documents concerning the Apla project, if you require so.)
2321

other/tokens_sale/config.json

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@
1616
"Name": "TsConsensusAction",
1717
"Conditions": "ContractConditions(\"@1DeveloperCondition\")"
1818
},
19+
{
20+
"Name": "TsFreeWalletAdd",
21+
"Conditions": "ContractConditions(\"@1DeveloperCondition\")"
22+
},
23+
{
24+
"Name": "TsFreeWalletDelete",
25+
"Conditions": "ContractConditions(\"@1DeveloperCondition\")"
26+
},
1927
{
2028
"Name": "TsKeyApprove",
2129
"Conditions": "ContractConditions(\"@1DeveloperCondition\")"
@@ -77,6 +85,16 @@
7785
"Conditions": "ContractConditions(\"@1DeveloperCondition\")",
7886
"Menu": "default_menu"
7987
},
88+
{
89+
"Name": "ts_free_wallet_add",
90+
"Conditions": "ContractConditions(\"@1DeveloperCondition\")",
91+
"Menu": "default_menu"
92+
},
93+
{
94+
"Name": "ts_free_wallets",
95+
"Conditions": "ContractConditions(\"@1DeveloperCondition\")",
96+
"Menu": "default_menu"
97+
},
8098
{
8199
"Name": "ts_key_approve",
82100
"Conditions": "ContractConditions(\"@1DeveloperCondition\")",
@@ -135,7 +153,7 @@
135153
},
136154
{
137155
"Name": "ts_wallets",
138-
"Permissions": "{\"insert\": \"ContractAccess(\\\"@1TsKeyApprove\\\")\", \"update\": \"ContractAccess(\\\"@1TsBuyerAction\\\",\\\"@1TsConsensusAction\\\")\", \"new_column\": \"ContractConditions(\\\"@1AdminCondition\\\")\"}"
156+
"Permissions": "{\"insert\": \"ContractAccess(\\\"@1TsFreeWalletAdd\\\")\", \"update\": \"ContractAccess(\\\"@1TsBuyerAction\\\",\\\"@1TsConsensusAction\\\",\\\"@1TsKeyApprove\\\",\\\"@1TsFreeWalletDelete\\\")\", \"new_column\": \"ContractConditions(\\\"@1AdminCondition\\\")\"}"
139157
}
140158
],
141159
"parameters": [
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
contract TsFreeWalletAdd {
2+
data {
3+
wallet_btc string
4+
wallet_eth string
5+
}
6+
7+
conditions {
8+
var adminRoleId int adminRoleName string
9+
adminRoleId = Int(EcosysParam("role_sale_admin"))
10+
adminRoleName = DBFind("@1roles").Where({"id": adminRoleId}).One("role_name")
11+
12+
if adminRoleId == 0 {
13+
warning Sprintf(LangRes("@1role_not_set_application_parameter", "en"), "role_sale_admin")
14+
}
15+
16+
if !RoleAccess(adminRoleId) {
17+
warning Sprintf(LangRes("x_role_only_action", "en"), adminRoleName)
18+
}
19+
20+
if DBFind("ts_wallets").Where({"wallet_btc": $wallet_btc}).One("id") {
21+
warning Sprintf(LangRes("wallet_btc_exists", "en"), $wallet_btc)
22+
}
23+
24+
if DBFind("ts_wallets").Where({"wallet_eth": $wallet_eth}).One("id") {
25+
warning Sprintf(LangRes("wallet_eth_exists", "en"), $wallet_eth)
26+
}
27+
}
28+
29+
action {
30+
DBInsert("ts_wallets", {"wallet_btc": $wallet_btc, "wallet_eth": $wallet_eth})
31+
}
32+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
contract TsFreeWalletDelete {
2+
data {
3+
wallet_id int
4+
}
5+
6+
conditions {
7+
var adminRoleId int adminRoleName string
8+
adminRoleId = Int(EcosysParam("role_sale_admin"))
9+
adminRoleName = DBFind("@1roles").Where({"id": adminRoleId}).One("role_name")
10+
11+
if adminRoleId == 0 {
12+
warning Sprintf(LangRes("@1role_not_set_application_parameter", "en"), "role_sale_admin")
13+
}
14+
15+
if !RoleAccess(adminRoleId) {
16+
warning Sprintf(LangRes("x_role_only_action", "en"), adminRoleName)
17+
}
18+
}
19+
20+
action {
21+
DBUpdate("ts_wallets", $wallet_id, {"deleted": 1})
22+
}
23+
}

other/tokens_sale/contracts/TsKeyApprove.sim

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,31 @@ contract TsKeyApprove {
55
current_role_id int
66
}
77

8+
func getFreeWallet() int {
9+
var count_wallets int wallet_map map wallet_arr array
10+
wallet_arr = DBFind("ts_wallets").Where({"key_id_buyer": 0, "deleted":0}).Order({"id": 1})
11+
12+
count_wallets = Len(wallet_arr)
13+
if count_wallets == 0 {
14+
warning LangRes("@1ts_free_wallet_not_found", "en")
15+
}
16+
17+
if count_wallets == 1 {
18+
var managerRoleId int
19+
managerRoleId = Int(EcosysParam("role_sale_manager"))
20+
if managerRoleId > 0 {
21+
var params map title page body string
22+
title = LangRes("@1ts_free_wallets_emptied", "en")
23+
body = LangRes("@1ts_free_wallets_need", "en")
24+
page = "@1ts_notification"
25+
@1NotificationsSend("rid,sender,text_header,text_body,page_name,params_map,closure_type,current_role_id", managerRoleId, 2, title, body, page, params, 1, $current_role_id)
26+
}
27+
}
28+
29+
wallet_map = wallet_arr[0]
30+
return Int(wallet_map["id"])
31+
}
32+
833
conditions {
934
if $public_key == "" {
1035
warning LangRes("@1public_key_empty", "en")
@@ -48,7 +73,10 @@ contract TsKeyApprove {
4873
@1TokensSend("Recipient,Amount", IdToAddress($userKey), start_balance)
4974

5075
if $key_type == "investor" {
51-
DBInsert("ts_wallets", {"key_id_buyer": $userKey, "created_at": $block_time})
76+
$wallet_id = getFreeWallet()
77+
$public_key = "04" + $public_key
78+
$pub_short_buyer = Substr($public_key, 0, 12) + "..." + Substr($public_key, Size($public_key)-12, 12)
79+
DBUpdate("ts_wallets", $wallet_id, {"key_id_buyer": $userKey, "created_at": $block_time, "pub_buyer": $public_key, "pub_short_buyer": $pub_short_buyer})
5280

5381
// new user notification
5482
var params map title page body string
Lines changed: 43 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,97 @@
11
contract TsTransferAdmin {
22
data {
33
WalletStr string
4-
Amount string
54
CurrencyType int
65
AmountApl money
76
TransferredDate string
87
TransferredTime string
98
}
10-
func getRoleId(name string) int{
9+
10+
func getRoleId(name string) int {
1111
var rid int
1212
rid = Int(EcosysParam(name))
13-
if rid == 0{
13+
if rid == 0 {
1414
warning Sprintf(LangRes("@1role_not_set_application_parameter", "en"), name)
1515
}
1616
return rid
1717
}
18+
1819
func trimZeroTime(s string) string {
1920
if Contains(s, "T00:00:00Z") {
2021
s = s Replace(s, "T00:00:00Z", "")
2122
}
2223
return s
2324
}
25+
2426
func dateAddTime(d, t string) string {
2527
var dt string
2628
if Size(t) == 5 {
2729
dt = Sprintf("%v %v:00", trimZeroTime(d), t)
2830
}
2931
return dt
3032
}
31-
conditions{
33+
34+
conditions {
3235
$WAITING_MANAGER = 1
3336
$WAITING_SELLER = 2
3437
$FINISHED = 3
3538
$REJECTED = 4
36-
if $AmountApl <= 0{
37-
warning "invalid amount APL"
38-
}
39-
if $Amount <= 0.0{
40-
warning "invalid amount"
39+
if $AmountApl <= 0 {
40+
warning "invalid amount APLA"
4141
}
4242

4343
$transferredAt = UnixDateTime(dateAddTime($TransferredDate, $TransferredTime))
4444
if $transferredAt == 0 {
4545
warning "invalid transfer datetime"
4646
}
47+
4748
$appId = Int(DBFind("@1applications").Where({ecosystem:$ecosystem_id, name:"Tokens sale"}).One("id"))
48-
if $appId == 0{
49+
if $appId == 0 {
4950
warning LangRes("@1app_not_found", "en")
5051
}
51-
$roleAplManager = getRoleId("role_sale_manager")
52+
5253
$currentRole = getRoleId("role_sale_admin")
53-
if !RoleAccess($currentRole){
54+
if !RoleAccess($currentRole) {
5455
warning "this action allowed only for role id #" + $currentRole
5556
}
5657

57-
$WalletId = AddressToId($WalletStr)
58-
$wallet = DBFind("ts_wallets").Where({key_id_buyer:$WalletId}).Row()
59-
if !$wallet{
60-
warning "Buyer wallet not found"
61-
}
62-
if $CurrencyType <= 0 || $CurrencyType > 3{
58+
if $CurrencyType <= 0 || $CurrencyType > 3 {
6359
warning "Invalid Currency Type"
6460
}
61+
62+
if $CurrencyType == 1 {
63+
$wallet = DBFind("ts_wallets").Where({wallet_btc: $WalletStr}).Row()
64+
}
65+
if $CurrencyType == 2 {
66+
$wallet = DBFind("ts_wallets").Where({wallet_eth: $WalletStr}).Row()
67+
}
68+
if $CurrencyType == 3 {
69+
if $WalletStr == "" {
70+
warning LangRes("@1public_key_empty", "en")
71+
}
72+
73+
$WalletStr = Replace($WalletStr, " ", "")
74+
if HasPrefix($WalletStr, "04") {
75+
$WalletStr = Substr($WalletStr, 2, Size($WalletStr) - 2)
76+
}
77+
var key_id_buyer int
78+
key_id_buyer = PubToID($WalletStr)
79+
if key_id_buyer == 0 || Size($WalletStr) != 128 {
80+
warning LangRes("@1public_key_invalid", "en")
81+
}
82+
83+
$wallet = DBFind("ts_wallets").Where({key_id_buyer: key_id_buyer}).Row()
84+
}
85+
86+
if !$wallet {
87+
warning "Buyer wallet not found"
88+
}
6589
}
6690

6791
action {
6892
var sale map saleId int
6993
sale["key_id_buyer"] = $wallet["key_id_buyer"]
7094
sale["currency_type"] = $CurrencyType
71-
sale["amount"] = $Amount
7295
sale["amount_apl"] = $AmountApl
7396
sale["key_id_sale_apl_admin"] = $key_id
7497
sale["created_at"] = $time
@@ -82,7 +105,7 @@ contract TsTransferAdmin {
82105
title = Sprintf("Check sale id %v", saleId)
83106
page = "ts_transfer_manager"
84107
params["sale_id"] = saleId
108+
$roleAplManager = getRoleId("role_sale_manager")
85109
@1NotificationsSend("rid,sender,text_header,page_name,params_map,closure_type,current_role_id", $roleAplManager, 2, title, page, params, 1, $currentRole)
86-
87110
}
88111
}

other/tokens_sale/menus/default_menu.ptl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@ If(#ecosystem_id# == 1){
2020
SetVar(seller_role_id, EcosysParam(Name:role_sale_seller))
2121

2222
Span("Set here the menu of the first ecosystem")
23-
If(And(#admin_role_id#>0,Or(#role_id#==#admin_role_id#,#role_id#==#manager_role_id#,#role_id#==#seller_role_id#))){
24-
MenuItem(Title:$@1ts_sales$, Page:@1ts_sales, Icon:"icon-credit-card")
23+
If(And(#role_id#>0,Or(#role_id#==#admin_role_id#,#role_id#==#manager_role_id#,#role_id#==#seller_role_id#,#role_id#==#snapswap_role_id#))){
24+
MenuItem(Title:$@1ts_free_wallets$, Page:@1ts_free_wallets, Icon:"icon-credit-card")
2525
}
26-
If(And(#snapswap_role_id#>0,#role_id#==#snapswap_role_id#)){
26+
If(And(#role_id#>0,Or(#role_id#==#admin_role_id#,#role_id#==#manager_role_id#,#role_id#==#seller_role_id#,#role_id#==#snapswap_role_id#))){
2727
MenuItem(Title:$@1ts_wallets$, Page:@1ts_wallets, Icon:"icon-credit-card")
2828
}
29+
If(And(#role_id#>0,Or(#role_id#==#admin_role_id#,#role_id#==#manager_role_id#,#role_id#==#seller_role_id#,#role_id#==#snapswap_role_id#))){
30+
MenuItem(Title:$@1ts_sales$, Page:@1ts_sales, Icon:"icon-credit-card")
31+
}
2932
}
3033
}

0 commit comments

Comments
 (0)