Venom In Action. Ways of code enhancing

Let's go over some best practice point, that will helps us to enhance a code we have. As you remember we have some tvm.rawReserve calls, like

tvm.rawReserve(1 ever, 0);

Moving that gas constants to standalone library is a good form. Same for external calling:

ITokenRoot(distributedTokenRoot).deployWallet {
    value: 0.2 ever,
    flag: 1,
    callback: Tokensale.onTokenWallet
}
(
    address(this),
    0.1 ever
);

Just create some library:

TokensaleGas.sol
pragma ever-solidity >= 0.61.2;

library TokensaleGas {
    uint128 constant INITIAL_BALANCE                                  = 0.7  ever;
    uint128 constant DEPLOY_EMPTY_WALLET_VALUE                        = 0.2  ever;
}

So that allow you to easily change gas variables for you contract

You can accept same idea for an error codes:

Last updated