Is there any way to get the code cell of the current smart contract?
Feb 23, 2023, 5:09 AM
Yes they have a function to get codecell "Cell.fromBoc(boc: string | UInt8Array)"
my codeBOC "te6ccgEBBAEAOQABFP8A9KQT9LzyyAsBAgFiAgMANNBsIdMfMO1E0NM/MAHAAZekyMs/ye1UkTDiABGhNDHaiaGmfmE="
everything is working fine with the "ton-core" package but for the current project I have to use "tonweb"
my codeBOC "te6ccgEBBAEAOQABFP8A9KQT9LzyyAsBAgFiAgMANNBsIdMfMO1E0NM/MAHAAZekyMs/ye1UkTDiABGhNDHaiaGmfmE="
everything is working fine with the "ton-core" package but for the current project I have to use "tonweb"
Feb 23, 2023, 5:28 AM
No I meant a FunC or TVM instruction for getting the current code cell from inside the smart contract. Something opposite of set_code
https://ton.org/docs/develop/func/stdlib/#set_code
https://ton.org/docs/develop/func/stdlib/#set_code
Feb 23, 2023, 5:37 AM
https://ton.org/docs/develop/func/stdlib/#get_c3
Feb 23, 2023, 5:39 AM
I have a codeBOC and have to create stateInit using tonweb
Feb 23, 2023, 6:05 AM
Thanks but that returns a cont not a cell. Need it to use as part of stateInit for another smart contract.
> Transforms slice s into a simple ordinary continuation c with c.code = s, and an empty stack, and savelist.
Is there anyway to access c.code from a continuation?
Is there anyway to access c.code from a continuation?
Feb 23, 2023, 6:54 AM
Recently, there have been problems in testnet, because more than 1/3 validators were shut down or unable to connect. I doubt you'll receive test TON for purpose of becoming a validator, though you may ask @f_closer.
You may try to connect your validator to MyLocalTon, then disabling it will be harmless.
You may try to connect your validator to MyLocalTon, then disabling it will be harmless.
You'll have to do some tricks with JMPXDATA. I think an easier way is to put code in a masterchain library and then reference it from all contracts.
By the way, I also have a question.
How can I build validator binaries for Windows from source code myself (to do some patches), how to launch that validator and how to connect it to MyLocalTon?
How can I build validator binaries for Windows from source code myself (to do some patches), how to launch that validator and how to connect it to MyLocalTon?
Feb 23, 2023, 7:40 AM
عذر میخواهم چون حس کردم ایرانی هستین فارسی نوشتم،قضیه چیه
چکار دقیقا بایست انجام داد؟؟
Feb 23, 2023, 8:06 AM
Thanks. Do you have any code samples for each of these?
Send your message in private chate please.
Feb 23, 2023, 9:18 AM
I would suggest the code to be the following:
SETCP 0
c4 PUSH
CTOS
PLDREF
CTOS
BLESS
CALLX
And put the actual code to first reference of data cell. Of course, you would need to change the code so that this data format is supported.
SETCP 0
c4 PUSH
CTOS
PLDREF
CTOS
BLESS
CALLX
And put the actual code to first reference of data cell. Of course, you would need to change the code so that this data format is supported.
Though, this way can lead to problems with code verification on tonscan/other explorers.
Feb 23, 2023, 9:21 AM
Let me ask in another way.
Currently, Jettons are implemented by storing the Wallet child smart contract code cell inside the wallet's data cell. Wallet code stores its own code in its data cell.
Isn't this a waste? I think a smart contract should be able to access its own code.
Currently, Jettons are implemented by storing the Wallet child smart contract code cell inside the wallet's data cell. Wallet code stores its own code in its data cell.
Isn't this a waste? I think a smart contract should be able to access its own code.
Feb 23, 2023, 10:47 AM
Yes, this is wasting space, though most people don't care.
TVM in TON doesn't have GETCODE. Possibly it should be added, as Everscale did.
TVM in TON doesn't have GETCODE. Possibly it should be added, as Everscale did.
Feb 23, 2023, 10:54 AM
it will solve just half the waste, still parent needs to hold the child code
but true that there are potentially millions of children so waste is bigger there
Feb 23, 2023, 10:56 AM
yes, it is. And, in my opinion, the solution is the following:
<{ SETCP0
0xHASHLIB hash>libref PUSHREF CTOS BLESS EXECUTE
}>c
but sadly looks like there are some broken components that doesnt supports exotic cells, so for now we have to wait. (basically load a code from publib and excute it, so you dont need to store the same long code in all child contract. In internal storage the code used for verification is still this one)
<{ SETCP0
0xHASHLIB hash>libref PUSHREF CTOS BLESS EXECUTE
}>c
but sadly looks like there are some broken components that doesnt supports exotic cells, so for now we have to wait. (basically load a code from publib and excute it, so you dont need to store the same long code in all child contract. In internal storage the code used for verification is still this one)
Feb 23, 2023, 11:00 AM
Is it a good idea to send the wallet code in a message, instead of storing it? Or would it impact the fees too much?
Feb 23, 2023, 5:40 PM
I don't understand the question.
Feb 24, 2023, 6:32 AM