-
Notifications
You must be signed in to change notification settings - Fork 114
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
feat: new functions in stdlib from stdlib.fc
and math.fc
#986
base: main
Are you sure you want to change the base?
Changes from 22 commits
19a5f30
a198af0
165a125
7941532
00790e4
293c7cc
fba75c7
f384afc
0e3d6b4
1db9371
a403986
364dbf8
30038ca
58c33b5
cbd36dc
2aca980
3dcaf2a
83d69e7
e801103
b0ec774
4d05722
734f3a0
a2da1a2
2b72e66
8453507
aa58a35
4e73eb4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,6 +73,7 @@ | |
"minmax", | ||
"mintable", | ||
"mktemp", | ||
"muldivc", | ||
"multiformats", | ||
"nanotons", | ||
"Neovim", | ||
|
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,4 +58,70 @@ contract StdlibTest { | |
get fun parseVarAddress(slice: Slice): VarAddress { | ||
return parseVarAddress(slice); | ||
} | ||
} | ||
|
||
get fun builderDepth(bl: Builder): Int { | ||
return bl.depth(); | ||
} | ||
|
||
get fun skipLastBits(sc: Slice, n: Int): Slice { | ||
return sc.skipLastBits(n); | ||
} | ||
|
||
get fun firstBits(sc: Slice, n: Int): Slice { | ||
return sc.firstBits(n); | ||
} | ||
|
||
get fun lastBits(sc: Slice, n: Int): Slice { | ||
return sc.lastBits(n); | ||
} | ||
|
||
get fun sliceDepth(sc: Slice): Int { | ||
return sc.depth(); | ||
} | ||
|
||
get fun addressNone(): Address? { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does it return "Maybe Address" and not "Address" ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because the way Tact currently work with addresses is that "null" as an address is actually addressNone There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, I checked the sources and you are 100% right, but maybe we should change it? struct Test {
my_addr: Address?;
}
results
In .md file (and maybe in some other places) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's an old problem in Tact, which was blocking multiple issues in the past. I remember some old comments in address-related issues about that. My opinion is that we should rework addresses, because currently the way they work is not intuitive and doesn't fit into how other types work. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
yeah, this is how it should work, indeed
also agreed
this one I'm not sure about, I'd say addr_none in the optional version should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
well yes, that's what I meant. I was talking about the possibility of the case when value of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Gusarich Maybe you could take care of this change first (allowing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could also probably add a config option to turn off address verification along the way |
||
return addressNone(); | ||
} | ||
|
||
get fun computeDataSizeCell(c: Cell, maxCells: Int): DataSize { | ||
return c.computeDataSize(maxCells); | ||
} | ||
|
||
get fun computeDataSizeSlice(sc: Slice, maxCells: Int): DataSize { | ||
return sc.computeDataSize(maxCells); | ||
} | ||
|
||
get fun cellDepth(c: Cell): Int { | ||
return c.depth(); | ||
} | ||
|
||
get fun curLt(): Int { | ||
return curLt(); | ||
} | ||
|
||
get fun blockLt(): Int { | ||
return blockLt(); | ||
} | ||
|
||
get fun setGasLimit(gl: Int): Int { | ||
setGasLimit(gl); | ||
let x = 0; | ||
repeat (100) { | ||
x += 1; | ||
} | ||
Shvandre marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return gasConsumed(); | ||
} | ||
|
||
get fun getSeed(): Int { | ||
return getSeed(); | ||
} | ||
|
||
get fun setSeed(seed: Int): Int { | ||
setSeed(seed); | ||
return getSeed(); | ||
} | ||
|
||
get fun myCode(): Cell { | ||
return myCode(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we want to also add
muldiv
?