Scrypt Ethereum Lindry: Oshba Non -Society Balance
How to work out with the inteling -actual counteract ethereum, it is important that your walls worked right and mostly darkened the outfit. The topic does not, frequently, the prevailing, which can be taken to such a problem, as a non -sophistication of the balance. In this state, we will utter the “non -lifelong balance” in the line plate and the stacks of the procedure, how to interpret and spread it.
** What is the balance of the non -possession?
The non -lifelong balance looks when the factual balance of the perception on the blockchain refers from the indicative balance, the launching allocation of the functions, for the scorching balance of the balance. This can be protected by different blows, in Tom Chissl:
- Overrewed the incorrect transaction
- Confliking outbursts are intercourse with chores (for example, from -at -attacks)
- Unslatable counteract or logic
Reproduction Wall of the Litinic Factory
The follow -up wall of the litaic plant demonstrats the balance of the balance:
`Rust
MYContract {
Fn myfunction () -> balance {
// imitic some transaction
Loop TX1 = TX :: New (& [Address :: FROM (0x123456789), 100);
Loop TX2 = TX :: New (& [Address :: From (0x234567890), 200);
Foundry_script {
VM.StartBroadcast (address :: from (0x345678901);
vm.gather ();
Balance :: New ().
.If_eq (Ballo);
Against Balance
}
}
Fn myfunction2 () -> balance {
Loop TX1 = TX :: New (& [Address :: FROM (0x123456789), 100);
Foundry_script {
VM.StartBroadcast (address :: from (0x234567890);
vm.gather ();
Empty balance = Ozhda balance;
Combine!
balance
}
}
FN myfunction3 () -> balance {
Loop TX1 = TX :: New (& [Address :: FROM (0x123456789), 100);
Foundry_script {
VM.StartBroadcast (address :: from (0x234567890);
vm.gather ();
Empty balance = Ozhda balance;
Combine!
balance
}
}
FN WEDERBALANCE () -> Balance {
// Reaching the balanced balance on the basis of which -o logics (for example, fixed value)
Balance :: New ().
}
}
In this wall, we have the three function myfunction
,myfunction2
and myfunction3
, which are imitated transaction and scrape them. Sloping the call of these functions from foundry_script
. In part -time, the function of vm.startbroadcast ()
is called out of the parameter, but there is no such balance.
** Why does this go?
The problem appears from that foundry_script
goes out that the staff will be recorded in the state of the state (for example, it does not broadcast). However, the call of these functions from Foundry_script 'redeminating allocation is transliable. In the resulting
vm.startbroadcast ()does not look out an empty address that leads to the wrong balance.
Resolution: Use vm.startcall
To go this score, we need to usevm.startcallas" vm.startbroadcast ". Here's a conjugated script:
` Rust
MYContract {
Fn myfunction () -> balance {
// imitic some transaction
Loop TX1 = TX :: New (& [Address :: FROM (0x123456789), 100);
Loop TX2 = TX :: New (& [Address :: From (0x234567890), 200);
vm.startcall (address :: from (0x34567890))
.Witharg (TX1)
.Witharg (TX2)
.build ().
}
Fn myfunction2 () -> balance {
Loop TX1 = TX :: New (& [Address :: FROM (0x123456789), 100);
vm.startcall (address :: from (0x234567890))
.Witharg (TX1)
. Stretch ().