Skip to content

Commit 302c570

Browse files
committed
Merge branch 'string-cairo240' into cairo240-string
2 parents a074bde + a8a73c1 commit 302c570

File tree

17 files changed

+6878
-13
lines changed

17 files changed

+6878
-13
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
//Cairo 2.4.0
2+
3+
#[starknet::interface]
4+
trait ITestReject<TContractState> {
5+
fn proceed_bytes31(self: @TContractState, str: bytes31) -> bytes31;
6+
fn get_string(self: @TContractState) -> ByteArray;
7+
fn proceed_string(self: @TContractState, mess: ByteArray) -> ByteArray;
8+
}
9+
10+
#[starknet::contract]
11+
mod MyTestReject {
12+
use core::option::OptionTrait;
13+
use core::traits::TryInto;
14+
use core::bytes_31::Bytes31Trait;
15+
use core::byte_array::ByteArrayTrait;
16+
#[storage]
17+
struct Storage {
18+
counter: u8
19+
}
20+
21+
#[external(v0)]
22+
impl TestReject of super::ITestReject<ContractState> {
23+
fn proceed_bytes31(self: @ContractState, str: bytes31) -> bytes31 {
24+
let mut mess: ByteArray = "azertzertrty dfghfghj dfgh dfghazert sdfgsdf ";
25+
mess.append_byte(55_u8);
26+
let mot: felt252 = ' Zorg';
27+
str
28+
}
29+
30+
fn get_string(self: @ContractState) -> ByteArray {
31+
let mut mess: ByteArray = "azertzertrty dfghfghj dfgh dfghazert sdfgsdf ";
32+
mess
33+
}
34+
35+
fn proceed_string(self: @ContractState, mess: ByteArray) -> ByteArray {
36+
let mut res = mess;
37+
let add: ByteArray = " Zorg is back";
38+
res.append(@add);
39+
res
40+
}
41+
}
42+
}

0 commit comments

Comments
 (0)