Remember, that we've introduced
asm functions in version 1.5.0 for you to write TVM assembly right in your Tact code?
asm fun keccak256(s: Slice): Int {
1 INT HASHEXT_KECCAK256
}
🐞 With this bugfix release, you now can use full* range of its syntax just like you could in similar
asm functions of FunC. Just don't do anything too crazy, like trying to shadow (re-define) { or }, or using char } inside your newly defined instructions.Other than that, have it your way. Note, that support of full Fift+TVM syntax is highly experimental, and will be reworked in future releases, in particular the following works now, but most likely won’t work at some point:
fun onchainSha256(data: String): Int {
_onchainShaPush(data);
while (_onchainShaShouldProceed()) {
_onchainShaOperate();
}
return _onchainShaHashExt();
}
// Helper assembly functions,
// each manipulating the stack in their own ways
// in different parts of the `onchainSha256()` function
asm fun _onchainShaPush(data: String) { ONE }
asm fun _onchainShaShouldProceed(): Bool {
OVER SREFS 0 NEQINT
}
asm fun _onchainShaOperate() {
OVER LDREF s0 POP CTOS s0 s1 XCHG INC
}
asm fun _onchainShaHashExt(): Int {
HASHEXT_SHA256
}🐞 Additionally, all new installations of
@tact-lang/compiler or @ton/blueprint via npm should work as expected. All other package managers continue to work fine, so create more awesome projects! We'll handle the rest ❤️👀 And keep an eye on the docs, something big might happen very soon!
🍲 every contract is open source if you can read bytecode
♨️ @tact_kitchen
