tact-lang / tact

Tact compiler main repository
https://tact-lang.org
MIT License
395 stars 111 forks source link

Add ability to use encoded init variables to optimize deployment gas usage #1023

Open imartemy1524 opened 2 weeks ago

imartemy1524 commented 2 weeks ago

If one wants to pass some values to contract using init/initOf he have to do this:

contract Test{
   flags: Int as uint8;
   init(f: Int){
       self.flags = f;
   }

}

But under the hood passing Int into init would serialize it as int257 (and send int257 in deployment data instead of int8). One can't do this:

contract Bob{
    init(f: Int as uint8, randomId: Int as uint64){
        self.flags = f;
    }
}

But on my opinion he should be able to.