Skip to content

Commit

Permalink
Check support for Chinese and Cyrillic Unicode text
Browse files Browse the repository at this point in the history
  • Loading branch information
anton-trunov committed Oct 17, 2023
1 parent 92a5a8b commit 015104f
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 57 deletions.
2 changes: 1 addition & 1 deletion examples/output/wallet_Wallet.abi
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"name":"Wallet","types":[{"name":"StateInit","header":null,"fields":[{"name":"code","type":{"kind":"simple","type":"cell","optional":false}},{"name":"data","type":{"kind":"simple","type":"cell","optional":false}}]},{"name":"Context","header":null,"fields":[{"name":"bounced","type":{"kind":"simple","type":"bool","optional":false}},{"name":"sender","type":{"kind":"simple","type":"address","optional":false}},{"name":"value","type":{"kind":"simple","type":"int","optional":false,"format":257}},{"name":"raw","type":{"kind":"simple","type":"slice","optional":false}}]},{"name":"SendParameters","header":null,"fields":[{"name":"bounce","type":{"kind":"simple","type":"bool","optional":false}},{"name":"to","type":{"kind":"simple","type":"address","optional":false}},{"name":"value","type":{"kind":"simple","type":"int","optional":false,"format":257}},{"name":"mode","type":{"kind":"simple","type":"int","optional":false,"format":257}},{"name":"body","type":{"kind":"simple","type":"cell","optional":true}},{"name":"code","type":{"kind":"simple","type":"cell","optional":true}},{"name":"data","type":{"kind":"simple","type":"cell","optional":true}}]},{"name":"Transfer","header":null,"fields":[{"name":"seqno","type":{"kind":"simple","type":"uint","optional":false,"format":32}},{"name":"mode","type":{"kind":"simple","type":"uint","optional":false,"format":8}},{"name":"to","type":{"kind":"simple","type":"address","optional":false}},{"name":"amount","type":{"kind":"simple","type":"uint","optional":false,"format":"coins"}},{"name":"body","type":{"kind":"simple","type":"cell","optional":true}}]},{"name":"TransferMessage","header":123,"fields":[{"name":"signature","type":{"kind":"simple","type":"slice","optional":false}},{"name":"transfer","type":{"kind":"simple","type":"Transfer","optional":false}}]}],"receivers":[{"receiver":"internal","message":{"kind":"text","text":"Deploy"}},{"receiver":"internal","message":{"kind":"typed","type":"TransferMessage"}},{"receiver":"internal","message":{"kind":"any"}},{"receiver":"internal","message":{"kind":"empty"}},{"receiver":"internal","message":{"kind":"text","text":"notify"}},{"receiver":"internal","message":{"kind":"text","text":"Слава Україні"}},{"receiver":"internal","message":{"kind":"text","text":"duplicate"}}],"getters":[{"name":"publicKey","arguments":[],"returnType":{"kind":"simple","type":"int","optional":false,"format":257}},{"name":"walletId","arguments":[],"returnType":{"kind":"simple","type":"int","optional":false,"format":257}},{"name":"seqno","arguments":[],"returnType":{"kind":"simple","type":"int","optional":false,"format":257}}],"errors":{"2":{"message":"Stack undeflow"},"3":{"message":"Stack overflow"},"4":{"message":"Integer overflow"},"5":{"message":"Integer out of expected range"},"6":{"message":"Invalid opcode"},"7":{"message":"Type check error"},"8":{"message":"Cell overflow"},"9":{"message":"Cell underflow"},"10":{"message":"Dictionary error"},"13":{"message":"Out of gas error"},"32":{"message":"Method ID not found"},"34":{"message":"Action is invalid or not supported"},"37":{"message":"Not enough TON"},"38":{"message":"Not enough extra-currencies"},"128":{"message":"Null reference exception"},"129":{"message":"Invalid serialization prefix"},"130":{"message":"Invalid incoming message"},"131":{"message":"Constraints error"},"132":{"message":"Access denied"},"133":{"message":"Contract stopped"},"134":{"message":"Invalid argument"},"135":{"message":"Code of a contract was not found"},"136":{"message":"Invalid address"},"137":{"message":"Masterchain support is not enabled for this contract"},"17654":{"message":"Invalid seqno"},"48401":{"message":"Invalid signature"}},"interfaces":["org.ton.introspection.v0","org.ton.abi.ipfs.v0","org.ton.deploy.lazy.v0","org.ton.chain.workchain.v0"]}
{"name":"Wallet","types":[{"name":"StateInit","header":null,"fields":[{"name":"code","type":{"kind":"simple","type":"cell","optional":false}},{"name":"data","type":{"kind":"simple","type":"cell","optional":false}}]},{"name":"Context","header":null,"fields":[{"name":"bounced","type":{"kind":"simple","type":"bool","optional":false}},{"name":"sender","type":{"kind":"simple","type":"address","optional":false}},{"name":"value","type":{"kind":"simple","type":"int","optional":false,"format":257}},{"name":"raw","type":{"kind":"simple","type":"slice","optional":false}}]},{"name":"SendParameters","header":null,"fields":[{"name":"bounce","type":{"kind":"simple","type":"bool","optional":false}},{"name":"to","type":{"kind":"simple","type":"address","optional":false}},{"name":"value","type":{"kind":"simple","type":"int","optional":false,"format":257}},{"name":"mode","type":{"kind":"simple","type":"int","optional":false,"format":257}},{"name":"body","type":{"kind":"simple","type":"cell","optional":true}},{"name":"code","type":{"kind":"simple","type":"cell","optional":true}},{"name":"data","type":{"kind":"simple","type":"cell","optional":true}}]},{"name":"Transfer","header":null,"fields":[{"name":"seqno","type":{"kind":"simple","type":"uint","optional":false,"format":32}},{"name":"mode","type":{"kind":"simple","type":"uint","optional":false,"format":8}},{"name":"to","type":{"kind":"simple","type":"address","optional":false}},{"name":"amount","type":{"kind":"simple","type":"uint","optional":false,"format":"coins"}},{"name":"body","type":{"kind":"simple","type":"cell","optional":true}}]},{"name":"TransferMessage","header":123,"fields":[{"name":"signature","type":{"kind":"simple","type":"slice","optional":false}},{"name":"transfer","type":{"kind":"simple","type":"Transfer","optional":false}}]}],"receivers":[{"receiver":"internal","message":{"kind":"text","text":"Deploy"}},{"receiver":"internal","message":{"kind":"typed","type":"TransferMessage"}},{"receiver":"internal","message":{"kind":"any"}},{"receiver":"internal","message":{"kind":"empty"}},{"receiver":"internal","message":{"kind":"text","text":"notify"}},{"receiver":"internal","message":{"kind":"text","text":"你好ж"}},{"receiver":"internal","message":{"kind":"text","text":"duplicate"}}],"getters":[{"name":"publicKey","arguments":[],"returnType":{"kind":"simple","type":"int","optional":false,"format":257}},{"name":"walletId","arguments":[],"returnType":{"kind":"simple","type":"int","optional":false,"format":257}},{"name":"seqno","arguments":[],"returnType":{"kind":"simple","type":"int","optional":false,"format":257}}],"errors":{"2":{"message":"Stack undeflow"},"3":{"message":"Stack overflow"},"4":{"message":"Integer overflow"},"5":{"message":"Integer out of expected range"},"6":{"message":"Invalid opcode"},"7":{"message":"Type check error"},"8":{"message":"Cell overflow"},"9":{"message":"Cell underflow"},"10":{"message":"Dictionary error"},"13":{"message":"Out of gas error"},"32":{"message":"Method ID not found"},"34":{"message":"Action is invalid or not supported"},"37":{"message":"Not enough TON"},"38":{"message":"Not enough extra-currencies"},"128":{"message":"Null reference exception"},"129":{"message":"Invalid serialization prefix"},"130":{"message":"Invalid incoming message"},"131":{"message":"Constraints error"},"132":{"message":"Access denied"},"133":{"message":"Contract stopped"},"134":{"message":"Invalid argument"},"135":{"message":"Code of a contract was not found"},"136":{"message":"Invalid address"},"137":{"message":"Masterchain support is not enabled for this contract"},"17654":{"message":"Invalid seqno"},"48401":{"message":"Invalid signature"}},"interfaces":["org.ton.introspection.v0","org.ton.abi.ipfs.v0","org.ton.deploy.lazy.v0","org.ton.chain.workchain.v0"]}
38 changes: 19 additions & 19 deletions examples/output/wallet_Wallet.code.fc
Original file line number Diff line number Diff line change
Expand Up @@ -133,89 +133,89 @@ _ lazy_deployment_completed() method_id {
((int, int, int), int) $Wallet$_contract_router_internal((int, int, int) self, int msg_bounced, slice in_msg) impure inline_ref {
;; Handle bounced messages
if (msg_bounced) {

;; Skip 0xFFFFFFFF
in_msg~skip_bits(32);

;; Fallback bounce receiver
self~$Wallet$_receive_bounce(in_msg);

return (self, true);
}

;; Parse incoming message
int op = 0;
if (slice_bits(in_msg) >= 32) {
op = in_msg.preload_uint(32);
}


;; Receive TransferMessage message
if (op == 123) {
var msg = in_msg~$TransferMessage$_load();
self~$Wallet$_internal_binary_TransferMessage(msg);
return (self, true);
}

;; Receive empty message
if ((op == 0) & (slice_bits(in_msg) <= 32)) {
self~%$Wallet$_internal_empty();
return (self, true);
}

;; Text Receivers
if (op == 0) {
var text_op = slice_hash(in_msg);

;; Receive "Deploy" message
if (text_op == 0x85d288384c0043458b02803cb22059f68803c553c3656344346468dac961f246) {
self~$Wallet$_internal_text_85d288384c0043458b02803cb22059f68803c553c3656344346468dac961f246();
return (self, true);
}

;; Receive "notify" message
if (text_op == 0x0e235726108b5700d0369dd7167f6affb806a7e04059375dd0e0fb24971e72b2) {
self~$Wallet$_internal_text_0e235726108b5700d0369dd7167f6affb806a7e04059375dd0e0fb24971e72b2();
return (self, true);
}
;; Receive "Слава Україні" message

;; Receive "你好ж" message
if (text_op == 0x269468fd4da0f5e0715746736242eba0fad9d28dafc7733bea9e7c6448889439) {
self~$Wallet$_internal_text_269468fd4da0f5e0715746736242eba0fad9d28dafc7733bea9e7c6448889439();
return (self, true);
}

;; Receive "duplicate" message
if (text_op == 0x9ca0f1855174e32e8fd378df56a6e4f6c40e4dfcb6090e49812f7b1e26214bf9) {
self~$Wallet$_internal_text_9ca0f1855174e32e8fd378df56a6e4f6c40e4dfcb6090e49812f7b1e26214bf9();
return (self, true);
}
}

;; Receiver fallback
self~$Wallet$_internal_any(in_msg);
return (self, true);
}

() recv_internal(int msg_value, cell in_msg_cell, slice in_msg) impure {

;; Context
var cs = in_msg_cell.begin_parse();
var msg_flags = cs~load_uint(4);
var msg_bounced = -(msg_flags & 1);
slice msg_sender_addr = __tact_verify_address(cs~load_msg_addr());
__tact_context = (msg_bounced, msg_sender_addr, msg_value, cs);
__tact_context_sender = msg_sender_addr;

;; Load contract data
var self = $Wallet$_contract_load();

;; Handle operation
int handled = self~$Wallet$_contract_router_internal(msg_bounced, in_msg);

;; Throw if not handled
throw_unless(130, handled);

;; Persist state
$Wallet$_contract_store(self);
}
Loading

0 comments on commit 015104f

Please sign in to comment.