native: implement HF-based update

A part of #3213.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This commit is contained in:
Anna Shaleva 2024-03-27 20:48:14 +03:00
parent 83fdcc8568
commit d62fad1268
19 changed files with 416 additions and 105 deletions

View file

@ -37,7 +37,6 @@ func newGAS(init int64, p2pSigExtensionsEnabled bool) *GAS {
initialSupply: init,
p2pSigExtensionsEnabled: p2pSigExtensionsEnabled,
}
defer g.UpdateHash()
nep17 := newNEP17Native(nativenames.Gas, gasContractID)
nep17.symbol = "GAS"
@ -83,7 +82,11 @@ func (g *GAS) balanceFromBytes(si *state.StorageItem) (*big.Int, error) {
}
// Initialize initializes a GAS contract.
func (g *GAS) Initialize(ic *interop.Context) error {
func (g *GAS) Initialize(ic *interop.Context, hf *config.Hardfork) error {
if hf != g.ActiveIn() {
return nil
}
if err := g.nep17TokenNative.Initialize(ic); err != nil {
return err
}