Rename NEO to Annos and GAS to Lub native contracts

Rename the core governance and utility tokens to reflect Tutus
blockchain's identity-centric design:

- NEO -> Annos (Latin for "years" - governance token tied to Vita)
- GAS -> Lub (lubrication - utility/fee token)

File renames:
- native_neo.go -> native_annos.go
- native_gas.go -> native_lub.go
- native_neo_candidate.go -> native_annos_candidate.go

Struct/interface renames:
- NEO struct -> Annos, INEO -> IAnnos
- GAS struct -> Lub, IGAS -> ILub

Constants updated:
- nativenames: Neo="NeoToken" -> Annos="AnnosToken"
- nativenames: Gas="GasToken" -> Lub="LubToken"
- NEOTotalSupply -> AnnosTotalSupply
- GASFactor -> LubFactor

Regenerated nativehashes for new manifest names.

Updated all native contracts, blockchain.go, test files,
CLI wallet, and RPC client packages.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Tutus Development 2025-12-20 11:34:42 +00:00
parent b5c87b5cf8
commit 64c682cd68
46 changed files with 432 additions and 432 deletions

View File

@ -272,9 +272,9 @@ func getNEPBalance(ctx *cli.Context, standard string, accHandler func(*cli.Conte
var h util.Uint160
// Well-known hardcoded names/symbols.
if standard == manifest.NEP17StandardName && (name == nativenames.Neo || name == "NEO") {
if standard == manifest.NEP17StandardName && (name == nativenames.Annos || name == "NEO") {
h = neo.Hash
} else if standard == manifest.NEP17StandardName && (name == nativenames.Gas || name == "GAS") {
} else if standard == manifest.NEP17StandardName && (name == nativenames.Lub || name == "GAS") {
h = gas.Hash
} else {
// The last resort, maybe it's a direct hash or address.

View File

@ -113,7 +113,7 @@ func handleRegister(ctx *cli.Context) error {
}
return gasT.TransferUnsigned(
acc.ScriptHash(),
nativehashes.NeoToken,
nativehashes.AnnosToken,
big.NewInt(regPrice),
acc.PublicKey().Bytes(),
)

View File

@ -92,8 +92,8 @@ func Init(t *testing.T, rootpath string, e *neotest.Executor) {
notaryModulePath = filepath.Join(rootpath, "pkg", "services", "notary")
)
gasHash := e.NativeHash(t, nativenames.Gas)
neoHash := e.NativeHash(t, nativenames.Neo)
gasHash := e.NativeHash(t, nativenames.Lub)
neoHash := e.NativeHash(t, nativenames.Annos)
policyHash := e.NativeHash(t, nativenames.Policy)
notaryHash := e.NativeHash(t, nativenames.Notary)
designationHash := e.NativeHash(t, nativenames.Designation)
@ -149,7 +149,7 @@ func Init(t *testing.T, rootpath string, e *neotest.Executor) {
t.Logf("txMoveNeo base64: %s", base64.StdEncoding.EncodeToString(txMoveNeo.Bytes()))
t.Logf("txMoveGas hash: %s", txMoveGas.Hash().StringLE())
e.EnsureGASBalance(t, priv0ScriptHash, func(balance *big.Int) bool { return balance.Cmp(big.NewInt(1000*native.GASFactor)) >= 0 })
e.EnsureGASBalance(t, priv0ScriptHash, func(balance *big.Int) bool { return balance.Cmp(big.NewInt(1000*native.LubFactor)) >= 0 })
// info for getblockheader rpc tests
t.Logf("header hash: %s", b.Hash().StringLE())
buf := io.NewBufBinWriter()

View File

@ -111,7 +111,7 @@ func NewDeployTx(bc Ledger, name string, sender util.Uint160, r gio.Reader, conf
return nil, util.Uint160{}, nil, err
}
tx := transaction.New(script, 100*native.GASFactor)
tx := transaction.New(script, 100*native.LubFactor)
tx.Signers = []transaction.Signer{{Account: sender}}
h := state.CreateContractHash(tx.Sender(), ne.Checksum, m.Name)

View File

@ -213,8 +213,8 @@ type Blockchain struct {
contracts *native.Contracts
management native.IManagement
policy native.IPolicy
neo native.INEO
gas native.IGAS
annos native.IAnnos
lub native.ILub
designate native.IDesignate
oracle native.IOracle
notary native.INotary
@ -435,18 +435,18 @@ func NewBlockchain(s storage.Store, cfg config.Blockchain, log *zap.Logger, newN
if err := validateNative(bc.management, nativeids.ContractManagement, nativenames.Management, nativehashes.ContractManagement); err != nil {
return nil, err
}
bc.neo = bc.contracts.NEO()
if bc.neo == native.INEO(nil) {
return nil, errors.New("native NeoToken implementation is required")
bc.annos = bc.contracts.Annos()
if bc.annos == native.IAnnos(nil) {
return nil, errors.New("native AnnosToken implementation is required")
}
if err := validateNative(bc.neo, nativeids.NeoToken, nativenames.Neo, nativehashes.NeoToken); err != nil {
if err := validateNative(bc.annos, nativeids.Annos, nativenames.Annos, nativehashes.AnnosToken); err != nil {
return nil, err
}
bc.gas = bc.contracts.GAS()
if bc.gas == native.IGAS(nil) {
return nil, errors.New("native GasToken implementation is required")
bc.lub = bc.contracts.Lub()
if bc.lub == native.ILub(nil) {
return nil, errors.New("native LubToken implementation is required")
}
if err := validateNative(bc.gas, nativeids.GasToken, nativenames.Gas, nativehashes.GasToken); err != nil {
if err := validateNative(bc.lub, nativeids.Lub, nativenames.Lub, nativehashes.LubToken); err != nil {
return nil, err
}
bc.policy = bc.contracts.Policy()
@ -2223,8 +2223,8 @@ func (bc *Blockchain) updateExtensibleWhitelist(height uint32) error {
return nil
}
newList := []util.Uint160{bc.neo.GetCommitteeAddress(bc.dao)}
nextVals := bc.neo.GetNextBlockValidatorsInternal(bc.dao)
newList := []util.Uint160{bc.annos.GetCommitteeAddress(bc.dao)}
nextVals := bc.annos.GetNextBlockValidatorsInternal(bc.dao)
script, err := smartcontract.CreateDefaultMultiSigRedeemScript(nextVals)
if err != nil {
return err
@ -2469,10 +2469,10 @@ func (bc *Blockchain) GetTokenLastUpdated(acc util.Uint160) (map[int32]uint32, e
return nil, err
}
if bc.config.P2PStateExchangeExtensions && bc.config.RemoveUntraceableBlocks {
if _, ok := info.LastUpdated[bc.neo.Metadata().ID]; !ok {
nBalance, lub := bc.neo.BalanceOf(bc.dao, acc)
if _, ok := info.LastUpdated[bc.annos.Metadata().ID]; !ok {
nBalance, lub := bc.annos.BalanceOf(bc.dao, acc)
if nBalance.Sign() != 0 {
info.LastUpdated[bc.neo.Metadata().ID] = lub
info.LastUpdated[bc.annos.Metadata().ID] = lub
}
}
}
@ -2485,7 +2485,7 @@ func (bc *Blockchain) GetTokenLastUpdated(acc util.Uint160) (map[int32]uint32, e
// GetUtilityTokenBalance returns utility token (GAS) balance for the acc.
func (bc *Blockchain) GetUtilityTokenBalance(acc util.Uint160) *big.Int {
bs := bc.gas.BalanceOf(bc.dao, acc)
bs := bc.lub.BalanceOf(bc.dao, acc)
if bs == nil {
return big.NewInt(0)
}
@ -2525,7 +2525,7 @@ func (bc *Blockchain) IsVitaFeeExempt(acc util.Uint160) bool {
// GetGoverningTokenBalance returns governing token (NEO) balance and the height
// of the last balance change for the account.
func (bc *Blockchain) GetGoverningTokenBalance(acc util.Uint160) (*big.Int, uint32) {
return bc.neo.BalanceOf(bc.dao, acc)
return bc.annos.BalanceOf(bc.dao, acc)
}
// GetNotaryBalance returns Notary deposit amount for the specified account.
@ -2905,7 +2905,7 @@ func (bc *Blockchain) CalculateClaimable(acc util.Uint160, endHeight uint32) (*b
return nil, err
}
ic := bc.newInteropContext(trigger.Application, bc.dao, nextBlock, nil)
return bc.neo.CalculateBonus(ic, acc, endHeight)
return bc.annos.CalculateBonus(ic, acc, endHeight)
}
// FeePerByte returns transaction network fee per byte.
@ -2932,7 +2932,7 @@ func (bc *Blockchain) ApplyPolicyToTxSet(txes []*transaction.Transaction) []*tra
curVC := bc.config.GetNumOfCNs(bc.BlockHeight() + 1)
if oldVC == nil || oldVC != curVC {
m := smartcontract.GetDefaultHonestNodeCount(curVC)
verification, _ := smartcontract.CreateDefaultMultiSigRedeemScript(bc.neo.GetNextBlockValidatorsInternal(bc.dao))
verification, _ := smartcontract.CreateDefaultMultiSigRedeemScript(bc.annos.GetNextBlockValidatorsInternal(bc.dao))
defaultWitness = transaction.Witness{
InvocationScript: make([]byte, 66*m),
VerificationScript: verification,
@ -3094,7 +3094,7 @@ func (bc *Blockchain) verifyTxAttributes(d *dao.Simple, tx *transaction.Transact
for i := range tx.Attributes {
switch attrType := tx.Attributes[i].Type; attrType {
case transaction.HighPriority:
h := bc.neo.GetCommitteeAddress(d)
h := bc.annos.GetCommitteeAddress(d)
if !tx.HasSigner(h) {
return fmt.Errorf("%w: high priority tx is not signed by committee", ErrInvalidAttribute)
}
@ -3254,7 +3254,7 @@ func (bc *Blockchain) PoolTxWithData(t *transaction.Transaction, data any, mp *m
// GetCommittee returns the sorted list of public keys of nodes in committee.
func (bc *Blockchain) GetCommittee() (keys.PublicKeys, error) {
pubs := bc.neo.GetCommitteeMembers(bc.dao)
pubs := bc.annos.GetCommitteeMembers(bc.dao)
slices.SortFunc(pubs, (*keys.PublicKey).Cmp)
return pubs, nil
}
@ -3267,7 +3267,7 @@ func (bc *Blockchain) GetCommittee() (keys.PublicKeys, error) {
// For the not-last block of dBFT epoch this method returns the same list as
// GetNextBlockValidators.
func (bc *Blockchain) ComputeNextBlockValidators() []*keys.PublicKey {
return bc.neo.ComputeNextBlockValidators(bc.dao)
return bc.annos.ComputeNextBlockValidators(bc.dao)
}
// GetNextBlockValidators returns next block validators. Validators list returned
@ -3277,12 +3277,12 @@ func (bc *Blockchain) ComputeNextBlockValidators() []*keys.PublicKey {
// method is being updated once per (committee size) number of blocks, but not
// every block.
func (bc *Blockchain) GetNextBlockValidators() ([]*keys.PublicKey, error) {
return bc.neo.GetNextBlockValidatorsInternal(bc.dao), nil
return bc.annos.GetNextBlockValidatorsInternal(bc.dao), nil
}
// GetEnrollments returns all registered validators.
func (bc *Blockchain) GetEnrollments() ([]state.Validator, error) {
return bc.neo.GetCandidates(bc.dao)
return bc.annos.GetCandidates(bc.dao)
}
// GetTestVM returns an interop context with VM set up for a test run.
@ -3524,14 +3524,14 @@ func (bc *Blockchain) verifyHeaderWitnesses(currHeader, prevHeader *block.Header
return err
}
// GoverningTokenHash returns the governing token (NEO) native contract hash.
// GoverningTokenHash returns the governing token (Annos) native contract hash.
func (bc *Blockchain) GoverningTokenHash() util.Uint160 {
return nativehashes.NeoToken
return nativehashes.AnnosToken
}
// UtilityTokenHash returns the utility token (GAS) native contract hash.
// UtilityTokenHash returns the utility token (Lub) native contract hash.
func (bc *Blockchain) UtilityTokenHash() util.Uint160 {
return nativehashes.GasToken
return nativehashes.LubToken
}
// ManagementContractHash returns management contract's hash.

View File

@ -23,7 +23,7 @@ import (
// Latin: "collocatio" = placement, arrangement (investment)
type Collocatio struct {
interop.ContractMD
NEO INEO
Annos IAnnos
Vita IVita
RoleRegistry *RoleRegistry
VTS *VTS
@ -597,7 +597,7 @@ func (c *Collocatio) activateOpportunity(ic *interop.Context, args []stackitem.I
}
caller := ic.VM.GetCallingScriptHash()
if caller != opp.Creator && !c.NEO.CheckCommittee(ic) {
if caller != opp.Creator && !c.Annos.CheckCommittee(ic) {
panic("only creator or committee can activate")
}
@ -792,7 +792,7 @@ func (c *Collocatio) setEligibility(ic *interop.Context, args []stackitem.Item)
eligFlags := state.EligibilityType(toUint64(args[1]))
// Only committee or RoleInvestmentManager can set eligibility
if !c.NEO.CheckCommittee(ic) {
if !c.Annos.CheckCommittee(ic) {
caller := ic.VM.GetCallingScriptHash()
if !c.RoleRegistry.HasRoleInternal(ic.DAO, caller, RoleInvestmentManager, ic.Block.Index) {
panic("only committee or investment manager can set eligibility")

View File

@ -29,9 +29,9 @@ type (
GetNEP17Contracts(d *dao.Simple) []util.Uint160
}
// INEO is an interface required from native NeoToken contract for
// IAnnos is an interface required from native AnnosToken contract for
// interaction with Blockchain and other native contracts.
INEO interface {
IAnnos interface {
interop.Contract
GetCommitteeAddress(d *dao.Simple) util.Uint160
GetNextBlockValidatorsInternal(d *dao.Simple) keys.PublicKeys
@ -46,9 +46,9 @@ type (
RevokeVotes(ic *interop.Context, h util.Uint160) error
}
// IGAS is an interface required from native GasToken contract for
// ILub is an interface required from native LubToken contract for
// interaction with Blockchain and other native contracts.
IGAS interface {
ILub interface {
interop.Contract
BalanceOf(d *dao.Simple, acc util.Uint160) *big.Int
@ -61,10 +61,10 @@ type (
// interaction with Blockchain and other native contracts.
IPolicy interface {
interop.Contract
// GetStoragePriceInternal returns the current storage price in picoGAS units.
// GetStoragePriceInternal returns the current storage price in picoLub units.
GetStoragePriceInternal(d *dao.Simple) int64
GetMaxVerificationGas(d *dao.Simple) int64
// GetExecFeeFactorInternal returns the current execution fee factor in picoGAS units.
// GetExecFeeFactorInternal returns the current execution fee factor in picoLub units.
GetExecFeeFactorInternal(d *dao.Simple) int64
GetMaxTraceableBlocksInternal(d *dao.Simple) uint32
GetMillisecondsPerBlockInternal(d *dao.Simple) uint32
@ -128,11 +128,11 @@ type (
// IRoleRegistry is an interface required from native RoleRegistry contract
// for interaction with Blockchain and other native contracts.
// RoleRegistry provides democratic governance for Tutus, replacing NEO.CheckCommittee().
// RoleRegistry provides democratic governance for Tutus, replacing Annos.CheckCommittee().
IRoleRegistry interface {
interop.Contract
// CheckCommittee returns true if caller has COMMITTEE role.
// This replaces NEO.CheckCommittee() for Tutus democratic governance.
// This replaces Annos.CheckCommittee() for Tutus democratic governance.
CheckCommittee(ic *interop.Context) bool
// HasRoleInternal checks if address has role (includes hierarchy).
HasRoleInternal(d *dao.Simple, address util.Uint160, roleID uint64, blockHeight uint32) bool
@ -372,16 +372,16 @@ func (cs *Contracts) Management() IManagement {
return cs.ByName(nativenames.Management).(IManagement)
}
// NEO returns native INEO contract implementation. It panics if there's no
// Annos returns native IAnnos contract implementation. It panics if there's no
// contract with proper name in cs.
func (cs *Contracts) NEO() INEO {
return cs.ByName(nativenames.Neo).(INEO)
func (cs *Contracts) Annos() IAnnos {
return cs.ByName(nativenames.Annos).(IAnnos)
}
// GAS returns native IGAS contract implementation. It panics if there's no
// Lub returns native ILub contract implementation. It panics if there's no
// contract with proper name in cs.
func (cs *Contracts) GAS() IGAS {
return cs.ByName(nativenames.Gas).(IGAS)
func (cs *Contracts) Lub() ILub {
return cs.ByName(nativenames.Lub).(ILub)
}
// Designate returns native IDesignate contract implementation. It panics if
@ -503,37 +503,37 @@ func NewDefaultContracts(cfg config.ProtocolConfiguration) []interop.Contract {
c := newCrypto()
ledger := NewLedger()
gas := newGAS(int64(cfg.InitialGASSupply))
neo := newNEO(cfg)
lub := newLub(int64(cfg.InitialGASSupply))
annos := newAnnos(cfg)
policy := newPolicy()
neo.GAS = gas
neo.Policy = policy
gas.NEO = neo
gas.Policy = policy
mgmt.NEO = neo
annos.Lub = lub
annos.Policy = policy
lub.Annos = annos
lub.Policy = policy
mgmt.Annos = annos
mgmt.Policy = policy
policy.NEO = neo
policy.Annos = annos
ledger.Policy = policy
desig := NewDesignate(cfg.Genesis.Roles)
desig.NEO = neo
desig.Annos = annos
oracle := newOracle()
oracle.GAS = gas
oracle.NEO = neo
oracle.Lub = lub
oracle.Annos = annos
oracle.Desig = desig
notary := newNotary()
notary.GAS = gas
notary.NEO = neo
notary.Lub = lub
notary.Annos = annos
notary.Desig = desig
notary.Policy = policy
treasury := newTreasury()
treasury.NEO = neo
treasury.Annos = annos
vita := newVita()
vita.NEO = neo
vita.Annos = annos
// Parse TutusCommittee addresses from config
var tutusCommittee []util.Uint160
@ -549,24 +549,24 @@ func NewDefaultContracts(cfg config.ProtocolConfiguration) []interop.Contract {
tutusCommittee = append(tutusCommittee, addr)
}
roleRegistry := newRoleRegistry(tutusCommittee)
roleRegistry.NEO = neo
roleRegistry.Annos = annos
// Set RoleRegistry on Vita for cross-contract integration
vita.RoleRegistry = roleRegistry
// Create VTS (Value Transfer System) contract
vts := newVTS()
vts.NEO = neo
vts.Annos = annos
vts.RoleRegistry = roleRegistry
vts.Vita = vita
// Create Federation contract for cross-chain Vita coordination
federation := newFederation()
federation.NEO = neo
federation.Annos = annos
// Create Lex (Law Registry) contract for universal rights and law enforcement
lex := newLex()
lex.NEO = neo
lex.Annos = annos
lex.Vita = vita
lex.RoleRegistry = roleRegistry
lex.Federation = federation
@ -577,42 +577,42 @@ func NewDefaultContracts(cfg config.ProtocolConfiguration) []interop.Contract {
// Wire Lex into Vita for liberty rights enforcement (due process)
vita.Lex = lex
// Wire GAS dependencies for Vita fee exemption
gas.Vita = vita
gas.Federation = federation
gas.Treasury = treasury
// Wire Lub dependencies for Vita fee exemption
lub.Vita = vita
lub.Federation = federation
lub.Treasury = treasury
// Create Eligere (Democratic Voting) contract
eligere := newEligere()
eligere.NEO = neo
eligere.Annos = annos
eligere.Vita = vita
eligere.RoleRegistry = roleRegistry
eligere.Lex = lex
// Create Scire (Universal Education) contract
scire := newScire()
scire.NEO = neo
scire.Annos = annos
scire.Vita = vita
scire.RoleRegistry = roleRegistry
scire.Lex = lex
// Create Salus (Universal Healthcare) contract
salus := newSalus()
salus.NEO = neo
salus.Annos = annos
salus.Vita = vita
salus.RoleRegistry = roleRegistry
salus.Lex = lex
// Create Sese (Life Planning) contract
sese := newSese()
sese.NEO = neo
sese.Annos = annos
sese.Vita = vita
sese.RoleRegistry = roleRegistry
sese.Lex = lex
// Create Tribute (Anti-Hoarding Economics) contract
tribute := newTribute()
tribute.NEO = neo
tribute.Annos = annos
tribute.Vita = vita
tribute.VTS = vts
tribute.RoleRegistry = roleRegistry
@ -620,7 +620,7 @@ func NewDefaultContracts(cfg config.ProtocolConfiguration) []interop.Contract {
// Create Opus (AI Workforce Integration) contract
opus := newOpus()
opus.NEO = neo
opus.Annos = annos
opus.Vita = vita
opus.VTS = vts
opus.RoleRegistry = roleRegistry
@ -629,14 +629,14 @@ func NewDefaultContracts(cfg config.ProtocolConfiguration) []interop.Contract {
// Create Palam (Programmed Transparency) contract
palam := NewPalam()
palam.NEO = neo
palam.Annos = annos
palam.Vita = vita
palam.RoleRegistry = roleRegistry
palam.Lex = lex
// Create Pons (Inter-Government Bridge) contract
pons := newPons()
pons.NEO = neo
pons.Annos = annos
pons.Vita = vita
pons.Federation = federation
pons.RoleRegistry = roleRegistry
@ -646,7 +646,7 @@ func NewDefaultContracts(cfg config.ProtocolConfiguration) []interop.Contract {
// Create Collocatio (Democratic Investment) contract
collocatio := newCollocatio()
collocatio.NEO = neo
collocatio.Annos = annos
collocatio.Vita = vita
collocatio.RoleRegistry = roleRegistry
collocatio.VTS = vts
@ -659,8 +659,8 @@ func NewDefaultContracts(cfg config.ProtocolConfiguration) []interop.Contract {
s,
c,
ledger,
neo,
gas,
annos,
lub,
policy,
desig,
oracle,

View File

@ -30,7 +30,7 @@ import (
// Designate represents a designation contract.
type Designate struct {
interop.ContractMD
NEO INEO
Annos IAnnos
// initialNodeRoles defines a set of node roles that should be defined at the contract
// deployment (initialization).
@ -405,7 +405,7 @@ func (s *Designate) DesignateAsRole(ic *interop.Context, r noderoles.Role, pubs
}
if ic.Trigger != trigger.OnPersist {
h := s.NEO.GetCommitteeAddress(ic.DAO)
h := s.Annos.GetCommitteeAddress(ic.DAO)
if ok, err := runtime.CheckHashedWitness(ic, h); err != nil || !ok {
return ErrInvalidWitness
}

View File

@ -74,7 +74,7 @@ var (
type Eligere struct {
interop.ContractMD
NEO INEO
Annos IAnnos
Vita IVita
RoleRegistry IRoleRegistry
Lex ILex
@ -430,10 +430,10 @@ func (e *Eligere) updateStatusIndex(d *dao.Simple, proposalID uint64, oldStatus,
// ============ Authorization Helpers ============
func (e *Eligere) checkCommittee(ic *interop.Context) bool {
if e.NEO == nil {
if e.Annos == nil {
return false
}
return e.NEO.CheckCommittee(ic)
return e.Annos.CheckCommittee(ic)
}
func (e *Eligere) hasLegislatorRole(d *dao.Simple, addr util.Uint160, blockHeight uint32) bool {

View File

@ -24,7 +24,7 @@ import (
// - Inter-chain debt (tracking fees owed to other chains)
type Federation struct {
interop.ContractMD
NEO INEO
Annos IAnnos
}
// Storage key prefixes for Federation.
@ -403,7 +403,7 @@ func (f *Federation) setFeePercent(ic *interop.Context, args []stackitem.Item) s
}
// Check committee
if !f.NEO.CheckCommittee(ic) {
if !f.Annos.CheckCommittee(ic) {
panic(ErrNotCommittee)
}
@ -435,7 +435,7 @@ func (f *Federation) registerVisitor(ic *interop.Context, args []stackitem.Item)
}
// Check committee
if !f.NEO.CheckCommittee(ic) {
if !f.Annos.CheckCommittee(ic) {
panic(ErrNotCommittee)
}
@ -463,7 +463,7 @@ func (f *Federation) unregisterVisitor(ic *interop.Context, args []stackitem.Ite
owner := toUint160(args[0])
// Check committee
if !f.NEO.CheckCommittee(ic) {
if !f.Annos.CheckCommittee(ic) {
panic(ErrNotCommittee)
}
@ -517,7 +517,7 @@ func (f *Federation) settleDebt(ic *interop.Context, args []stackitem.Item) stac
}
// Check committee
if !f.NEO.CheckCommittee(ic) {
if !f.Annos.CheckCommittee(ic) {
panic(ErrNotCommittee)
}
@ -559,7 +559,7 @@ func (f *Federation) grantAsylum(ic *interop.Context, args []stackitem.Item) sta
}
// Check committee
if !f.NEO.CheckCommittee(ic) {
if !f.Annos.CheckCommittee(ic) {
panic(ErrNotCommittee)
}
@ -588,7 +588,7 @@ func (f *Federation) revokeAsylum(ic *interop.Context, args []stackitem.Item) st
owner := toUint160(args[0])
// Check committee
if !f.NEO.CheckCommittee(ic) {
if !f.Annos.CheckCommittee(ic) {
panic(ErrNotCommittee)
}
@ -636,7 +636,7 @@ func (f *Federation) naturalize(ic *interop.Context, args []stackitem.Item) stac
originalHomeChain := uint32(toBigInt(args[1]).Int64())
// Check committee
if !f.NEO.CheckCommittee(ic) {
if !f.Annos.CheckCommittee(ic) {
panic(ErrNotCommittee)
}

View File

@ -34,7 +34,7 @@ func TestNativeContract_Invoke(t *testing.T) {
)
bc, validator, committee := chain.NewMulti(t)
e := neotest.NewExecutor(t, bc, validator, committee)
gasHash := e.NativeHash(t, nativenames.Gas)
gasHash := e.NativeHash(t, nativenames.Lub)
baseExecFee := bc.GetBaseExecFee()
price := fee.Opcode(baseExecFee, opcode.SYSCALL, // System.Contract.Call
@ -96,7 +96,7 @@ func TestNativeContract_InvokeInternal(t *testing.T) {
c.NativeUpdateHistories = map[string][]uint32{
nativenames.Policy: {0},
nativenames.Neo: {0},
nativenames.Gas: {0},
nativenames.Lub: {0},
nativenames.Designation: {0},
nativenames.StdLib: {0},
nativenames.Management: {0},
@ -200,7 +200,7 @@ func TestNativeContract_InvokeOtherContract(t *testing.T) {
bc, validator, committee := chain.NewMulti(t)
e := neotest.NewExecutor(t, bc, validator, committee)
managementInvoker := e.ValidatorInvoker(e.NativeHash(t, nativenames.Management))
gasInvoker := e.ValidatorInvoker(e.NativeHash(t, nativenames.Gas))
gasInvoker := e.ValidatorInvoker(e.NativeHash(t, nativenames.Lub))
cs, _ := contracts.GetTestContractState(t, pathToInternalContracts, 1, 2, validator.ScriptHash())
cs.Hash = state.CreateContractHash(validator.ScriptHash(), cs.NEF.Checksum, cs.Manifest.Name) // set proper hash

View File

@ -27,7 +27,7 @@ import (
// - Cross-contract compliance checking
type Lex struct {
interop.ContractMD
NEO INEO
Annos IAnnos
Vita IVita
RoleRegistry IRoleRegistry
Federation IFederation
@ -460,7 +460,7 @@ func (l *Lex) checkCommittee(ic *interop.Context) error {
if l.RoleRegistry != nil && l.RoleRegistry.CheckCommittee(ic) {
return nil
}
if l.NEO != nil && l.NEO.CheckCommittee(ic) {
if l.Annos != nil && l.Annos.CheckCommittee(ic) {
return nil
}
return ErrNotAuthorized

View File

@ -35,7 +35,7 @@ import (
// Management is a contract-managing native contract.
type Management struct {
interop.ContractMD
NEO INEO
Annos IAnnos
Policy IPolicy
}
@ -556,7 +556,7 @@ func (m *Management) setMinimumDeploymentFee(ic *interop.Context, args []stackit
if value.Sign() < 0 {
panic("MinimumDeploymentFee cannot be negative")
}
if !m.NEO.CheckCommittee(ic) {
if !m.Annos.CheckCommittee(ic) {
panic("invalid committee signature")
}
ic.DAO.PutStorageItem(m.ID, keyMinimumDeploymentFee, bigint.ToBytes(value))

View File

@ -25,8 +25,8 @@ func TestManagement_GetNEP17Contracts(t *testing.T) {
e := neotest.NewExecutor(t, bc, validators, committee)
// Native NEP17 contracts: NEO, GAS, and VTS
require.ElementsMatch(t, []util.Uint160{e.NativeHash(t, nativenames.Neo),
e.NativeHash(t, nativenames.Gas), e.NativeHash(t, nativenames.VTS)}, bc.GetNEP17Contracts())
require.ElementsMatch(t, []util.Uint160{e.NativeHash(t, nativenames.Annos),
e.NativeHash(t, nativenames.Lub), e.NativeHash(t, nativenames.VTS)}, bc.GetNEP17Contracts())
})
t.Run("basic chain", func(t *testing.T) {
@ -35,8 +35,8 @@ func TestManagement_GetNEP17Contracts(t *testing.T) {
basicchain.Init(t, "../../../", e)
// Native NEP17 contracts: NEO, GAS, VTS + deployed contract
require.ElementsMatch(t, []util.Uint160{e.NativeHash(t, nativenames.Neo),
e.NativeHash(t, nativenames.Gas), e.NativeHash(t, nativenames.VTS), e.ContractHash(t, 1)}, bc.GetNEP17Contracts())
require.ElementsMatch(t, []util.Uint160{e.NativeHash(t, nativenames.Annos),
e.NativeHash(t, nativenames.Lub), e.NativeHash(t, nativenames.VTS), e.ContractHash(t, 1)}, bc.GetNEP17Contracts())
})
}

View File

@ -18,34 +18,34 @@ import (
"github.com/stretchr/testify/require"
)
type neo struct{}
type annos struct{}
func (n neo) Initialize(context *interop.Context, hardfork *config.Hardfork, md *interop.HFSpecificContractMD) error {
func (n annos) Initialize(context *interop.Context, hardfork *config.Hardfork, md *interop.HFSpecificContractMD) error {
panic("TODO")
}
func (n neo) ActiveIn() *config.Hardfork { panic("TODO") }
func (n neo) InitializeCache(isHardforkEnabled interop.IsHardforkEnabled, blockHeight uint32, d *dao.Simple) error {
func (n annos) ActiveIn() *config.Hardfork { panic("TODO") }
func (n annos) InitializeCache(isHardforkEnabled interop.IsHardforkEnabled, blockHeight uint32, d *dao.Simple) error {
panic("TODO")
}
func (n neo) Metadata() *interop.ContractMD { panic("TODO") }
func (n neo) OnPersist(context *interop.Context) error { panic("TODO") }
func (n neo) PostPersist(context *interop.Context) error { panic("TODO") }
func (n neo) GetCommitteeAddress(d *dao.Simple) util.Uint160 { panic("TODO") }
func (n neo) GetNextBlockValidatorsInternal(d *dao.Simple) keys.PublicKeys { panic("TODO") }
func (n neo) BalanceOf(d *dao.Simple, acc util.Uint160) (*big.Int, uint32) { panic("TODO") }
func (n neo) CalculateBonus(ic *interop.Context, acc util.Uint160, endHeight uint32) (*big.Int, error) {
func (n annos) Metadata() *interop.ContractMD { panic("TODO") }
func (n annos) OnPersist(context *interop.Context) error { panic("TODO") }
func (n annos) PostPersist(context *interop.Context) error { panic("TODO") }
func (n annos) GetCommitteeAddress(d *dao.Simple) util.Uint160 { panic("TODO") }
func (n annos) GetNextBlockValidatorsInternal(d *dao.Simple) keys.PublicKeys { panic("TODO") }
func (n annos) BalanceOf(d *dao.Simple, acc util.Uint160) (*big.Int, uint32) { panic("TODO") }
func (n annos) CalculateBonus(ic *interop.Context, acc util.Uint160, endHeight uint32) (*big.Int, error) {
panic("TODO")
}
func (n neo) GetCommitteeMembers(d *dao.Simple) keys.PublicKeys { panic("TODO") }
func (n neo) ComputeNextBlockValidators(d *dao.Simple) keys.PublicKeys { panic("TODO") }
func (n neo) GetCandidates(d *dao.Simple) ([]state.Validator, error) { panic("TODO") }
func (n neo) CheckCommittee(ic *interop.Context) bool { panic("TODO") }
func (n neo) RevokeVotes(ic *interop.Context, h util.Uint160) error { return nil }
func (n annos) GetCommitteeMembers(d *dao.Simple) keys.PublicKeys { panic("TODO") }
func (n annos) ComputeNextBlockValidators(d *dao.Simple) keys.PublicKeys { panic("TODO") }
func (n annos) GetCandidates(d *dao.Simple) ([]state.Validator, error) { panic("TODO") }
func (n annos) CheckCommittee(ic *interop.Context) bool { panic("TODO") }
func (n annos) RevokeVotes(ic *interop.Context, h util.Uint160) error { return nil }
func TestDeployGetUpdateDestroyContract(t *testing.T) {
mgmt := NewManagement()
p := newPolicy()
p.NEO = neo{}
p.Annos = annos{}
mgmt.Policy = p
d := dao.NewSimple(storage.NewMemoryStore(), false)

View File

@ -32,10 +32,10 @@ import (
"github.com/tutus-one/tutus-chain/pkg/vm/stackitem"
)
// NEO represents NEO native contract.
type NEO struct {
// Annos represents Annos native contract (governance token - years/lifespan).
type Annos struct {
nep17TokenNative
GAS IGAS
Lub ILub
Policy IPolicy
// Configuration and standby keys are set in constructor and then
@ -44,7 +44,7 @@ type NEO struct {
standbyKeys keys.PublicKeys
}
type NeoCache struct {
type AnnosCache struct {
// gasPerBlock represents the history of generated gas per block.
gasPerBlock gasRecord
@ -80,31 +80,31 @@ type NeoCache struct {
}
const (
// NEOTotalSupply is the total amount of NEO in the system.
NEOTotalSupply = 100000000
// AnnosTotalSupply is the total amount of Annos in the system.
AnnosTotalSupply = 100000000
// DefaultRegisterPrice is the default price for candidate register.
DefaultRegisterPrice = 1000 * GASFactor
DefaultRegisterPrice = 1000 * LubFactor
// prefixCandidate is a prefix used to store validator's data.
prefixCandidate = 33
// prefixVotersCount is a prefix for storing total amount of NEO of voters.
// prefixVotersCount is a prefix for storing total amount of Annos of voters.
prefixVotersCount = 1
// prefixVoterRewardPerCommittee is a prefix for storing committee GAS reward.
// prefixVoterRewardPerCommittee is a prefix for storing committee Lub reward.
prefixVoterRewardPerCommittee = 23
// voterRewardFactor is a factor by which voter reward per committee is multiplied
// to make calculations more precise.
voterRewardFactor = 100_000_000
// prefixGASPerBlock is a prefix for storing amount of GAS generated per block.
prefixGASPerBlock = 29
// prefixLubPerBlock is a prefix for storing amount of Lub generated per block.
prefixLubPerBlock = 29
// prefixRegisterPrice is a prefix for storing candidate register price.
prefixRegisterPrice = 13
// effectiveVoterTurnout represents minimal ratio of total supply to total amount voted value
// which is require to use non-standby validators.
effectiveVoterTurnout = 5
// neoHolderRewardRatio is a percent of generated GAS that is distributed to NEO holders.
neoHolderRewardRatio = 10
// committeeRewardRatio is a percent of generated GAS that is distributed to committee.
// annosHolderRewardRatio is a percent of generated Lub that is distributed to Annos holders.
annosHolderRewardRatio = 10
// committeeRewardRatio is a percent of generated Lub that is distributed to committee.
committeeRewardRatio = 10
// voterRewardRatio is a percent of generated GAS that is distributed to voters.
// voterRewardRatio is a percent of generated Lub that is distributed to voters.
voterRewardRatio = 80
// maxGetCandidatesRespLen is the maximum number of candidates to return from the
@ -124,18 +124,18 @@ var (
)
var (
_ interop.Contract = (*NEO)(nil)
_ dao.NativeContractCache = (*NeoCache)(nil)
_ interop.Contract = (*Annos)(nil)
_ dao.NativeContractCache = (*AnnosCache)(nil)
)
// Copy implements NativeContractCache interface.
func (c *NeoCache) Copy() dao.NativeContractCache {
cp := &NeoCache{}
copyNeoCache(c, cp)
func (c *AnnosCache) Copy() dao.NativeContractCache {
cp := &AnnosCache{}
copyAnnosCache(c, cp)
return cp
}
func copyNeoCache(src, dst *NeoCache) {
func copyAnnosCache(src, dst *AnnosCache) {
dst.votesChanged = src.votesChanged
// Can safely omit copying because the new array is created each time
// newEpochNextValidators list, nextValidators and committee are updated.
@ -165,17 +165,17 @@ func makeValidatorKey(key *keys.PublicKey) []byte {
return b
}
// newNEO returns NEO native contract.
func newNEO(cfg config.ProtocolConfiguration) *NEO {
n := &NEO{}
// newAnnos returns Annos native contract.
func newAnnos(cfg config.ProtocolConfiguration) *Annos {
n := &Annos{}
defer n.BuildHFSpecificMD(n.ActiveIn())
nep17 := newNEP17Native(nativenames.Neo, nativeids.NeoToken, func(m *manifest.Manifest, hf config.Hardfork) {
nep17 := newNEP17Native(nativenames.Annos, nativeids.Annos, func(m *manifest.Manifest, hf config.Hardfork) {
if hf.Cmp(config.HFEchidna) >= 0 {
m.SupportedStandards = append(m.SupportedStandards, manifest.NEP27StandardName)
}
})
nep17.symbol = "NEO"
nep17.symbol = "ANNOS"
nep17.decimals = 0
nep17.factor = 1
nep17.incBalance = n.increaseBalance
@ -185,7 +185,7 @@ func newNEO(cfg config.ProtocolConfiguration) *NEO {
err := n.initConfigCache(cfg)
if err != nil {
panic(fmt.Errorf("failed to initialize NEO config cache: %w", err))
panic(fmt.Errorf("failed to initialize Annos config cache: %w", err))
}
desc := NewDescriptor("unclaimedGas", smartcontract.IntegerType,
@ -301,8 +301,8 @@ func newNEO(cfg config.ProtocolConfiguration) *NEO {
return n
}
// Initialize initializes a NEO contract.
func (n *NEO) Initialize(ic *interop.Context, hf *config.Hardfork, newMD *interop.HFSpecificContractMD) error {
// Initialize initializes an Annos contract.
func (n *Annos) Initialize(ic *interop.Context, hf *config.Hardfork, newMD *interop.HFSpecificContractMD) error {
if hf != n.ActiveIn() {
return nil
}
@ -316,7 +316,7 @@ func (n *NEO) Initialize(ic *interop.Context, hf *config.Hardfork, newMD *intero
return errors.New("already initialized")
}
cache := &NeoCache{
cache := &AnnosCache{
gasPerVoteCache: make(map[string]big.Int),
votesChanged: true,
}
@ -337,10 +337,10 @@ func (n *NEO) Initialize(ic *interop.Context, hf *config.Hardfork, newMD *intero
if err != nil {
return err
}
n.Mint(ic, h, big.NewInt(NEOTotalSupply), false)
n.Mint(ic, h, big.NewInt(AnnosTotalSupply), false)
var index uint32
value := big.NewInt(5 * GASFactor)
value := big.NewInt(5 * LubFactor)
n.putGASRecord(ic.DAO, index, value)
gr := &gasRecord{{Index: index, GASPerBlock: *value}}
@ -358,12 +358,12 @@ func (n *NEO) Initialize(ic *interop.Context, hf *config.Hardfork, newMD *intero
return nil
}
// InitializeCache initializes all NEO cache with the proper values from the storage.
// InitializeCache initializes all Annos cache with the proper values from the storage.
// Cache initialization should be done apart from Initialize because Initialize is
// called only when deploying native contracts. InitializeCache implements the Contract
// interface.
func (n *NEO) InitializeCache(_ interop.IsHardforkEnabled, blockHeight uint32, d *dao.Simple) error {
cache := &NeoCache{
func (n *Annos) InitializeCache(_ interop.IsHardforkEnabled, blockHeight uint32, d *dao.Simple) error {
cache := &AnnosCache{
gasPerVoteCache: make(map[string]big.Int),
votesChanged: true,
}
@ -401,11 +401,11 @@ func (n *NEO) InitializeCache(_ interop.IsHardforkEnabled, blockHeight uint32, d
}
// ActiveIn implements the Contract interface.
func (n *NEO) ActiveIn() *config.Hardfork {
func (n *Annos) ActiveIn() *config.Hardfork {
return nil
}
func (n *NEO) initConfigCache(cfg config.ProtocolConfiguration) error {
func (n *Annos) initConfigCache(cfg config.ProtocolConfiguration) error {
var err error
n.cfg = cfg
@ -413,7 +413,7 @@ func (n *NEO) initConfigCache(cfg config.ProtocolConfiguration) error {
return err
}
func (n *NEO) updateCache(cache *NeoCache, cvs keysWithVotes, blockHeight uint32) error {
func (n *Annos) updateCache(cache *AnnosCache, cvs keysWithVotes, blockHeight uint32) error {
cache.committee = cvs
var committee = getCommitteeMembers(cache.committee)
@ -435,7 +435,7 @@ func (n *NEO) updateCache(cache *NeoCache, cvs keysWithVotes, blockHeight uint32
// will be used by corresponding values initialisation on the next epoch start.
// The updated new epoch cached values computed using the persisted blocks state
// of the latest epoch.
func (n *NEO) updateCachedNewEpochValues(d *dao.Simple, cache *NeoCache, blockHeight uint32, numOfCNs int) error {
func (n *Annos) updateCachedNewEpochValues(d *dao.Simple, cache *AnnosCache, blockHeight uint32, numOfCNs int) error {
committee, cvs, err := n.computeCommitteeMembers(blockHeight, d)
if err != nil {
return fmt.Errorf("failed to compute committee members: %w", err)
@ -455,9 +455,9 @@ func (n *NEO) updateCachedNewEpochValues(d *dao.Simple, cache *NeoCache, blockHe
}
// OnPersist implements the Contract interface.
func (n *NEO) OnPersist(ic *interop.Context) error {
func (n *Annos) OnPersist(ic *interop.Context) error {
if n.cfg.ShouldUpdateCommitteeAt(ic.Block.Index) {
cache := ic.DAO.GetRWCache(n.ID).(*NeoCache)
cache := ic.DAO.GetRWCache(n.ID).(*AnnosCache)
// Cached newEpoch* values always have proper value set (either by PostPersist
// during the last epoch block handling or by initialization code).
@ -493,14 +493,14 @@ func (n *NEO) OnPersist(ic *interop.Context) error {
}
// PostPersist implements the Contract interface.
func (n *NEO) PostPersist(ic *interop.Context) error {
func (n *Annos) PostPersist(ic *interop.Context) error {
gas := n.GetGASPerBlock(ic.DAO, ic.BlockHeight()+1)
cache := ic.DAO.GetROCache(n.ID).(*NeoCache)
cache := ic.DAO.GetROCache(n.ID).(*AnnosCache)
pubs := getCommitteeMembers(cache.committee)
committeeSize := n.cfg.GetCommitteeSize(ic.Block.Index)
index := int(ic.Block.Index) % committeeSize
committeeReward := new(big.Int).Mul(gas, bigCommitteeRewardRatio)
n.GAS.Mint(ic, pubs[index].GetScriptHash(), committeeReward.Div(committeeReward, big100), false)
n.Lub.Mint(ic, pubs[index].GetScriptHash(), committeeReward.Div(committeeReward, big100), false)
var isCacheRW bool
if n.cfg.ShouldUpdateCommitteeAt(ic.Block.Index) {
@ -531,7 +531,7 @@ func (n *NEO) PostPersist(ic *interop.Context) error {
tmp.Add(tmp, &r)
if !isCacheRW {
cache = ic.DAO.GetRWCache(n.ID).(*NeoCache)
cache = ic.DAO.GetRWCache(n.ID).(*AnnosCache)
isCacheRW = true
}
cache.gasPerVoteCache[cs[i].Key] = *tmp
@ -552,7 +552,7 @@ func (n *NEO) PostPersist(ic *interop.Context) error {
numOfCNs != len(cache.newEpochNextValidators) ||
n.cfg.GetCommitteeSize(h+1) != len(cache.newEpochCommittee) {
if !isCacheRW {
cache = ic.DAO.GetRWCache(n.ID).(*NeoCache)
cache = ic.DAO.GetRWCache(n.ID).(*AnnosCache)
}
err := n.updateCachedNewEpochValues(ic.DAO, cache, h, numOfCNs)
if err != nil {
@ -564,9 +564,9 @@ func (n *NEO) PostPersist(ic *interop.Context) error {
return nil
}
func (n *NEO) getLatestGASPerVote(d *dao.Simple, key []byte) big.Int {
func (n *Annos) getLatestGASPerVote(d *dao.Simple, key []byte) big.Int {
var g big.Int
cache := d.GetROCache(n.ID).(*NeoCache)
cache := d.GetROCache(n.ID).(*AnnosCache)
if g, ok := cache.gasPerVoteCache[string(key[1:])]; ok {
return g
}
@ -579,7 +579,7 @@ func (n *NEO) getLatestGASPerVote(d *dao.Simple, key []byte) big.Int {
return g
}
func (n *NEO) increaseBalance(ic *interop.Context, h util.Uint160, si *state.StorageItem, amount *big.Int, checkBal *big.Int) (func(), error) {
func (n *Annos) increaseBalance(ic *interop.Context, h util.Uint160, si *state.StorageItem, amount *big.Int, checkBal *big.Int) (func(), error) {
var postF func()
acc, err := state.NEOBalanceFromBytes(*si)
@ -595,7 +595,7 @@ func (n *NEO) increaseBalance(ic *interop.Context, h util.Uint160, si *state.Sto
return nil, err
}
if newGas != nil { // Can be if it was already distributed in the same block.
postF = func() { n.GAS.Mint(ic, h, newGas, true) }
postF = func() { n.Lub.Mint(ic, h, newGas, true) }
}
if amount.Sign() == 0 {
*si = acc.Bytes(ic.DAO.GetItemCtx())
@ -618,7 +618,7 @@ func (n *NEO) increaseBalance(ic *interop.Context, h util.Uint160, si *state.Sto
return postF, nil
}
func (n *NEO) balanceFromBytes(si *state.StorageItem) (*big.Int, error) {
func (n *Annos) balanceFromBytes(si *state.StorageItem) (*big.Int, error) {
acc, err := state.NEOBalanceFromBytes(*si)
if err != nil {
return nil, err
@ -626,7 +626,7 @@ func (n *NEO) balanceFromBytes(si *state.StorageItem) (*big.Int, error) {
return &acc.Balance, err
}
func (n *NEO) distributeGas(ic *interop.Context, acc *state.NEOBalance) (*big.Int, error) {
func (n *Annos) distributeGas(ic *interop.Context, acc *state.NEOBalance) (*big.Int, error) {
if ic.Block == nil || ic.Block.Index == 0 || ic.Block.Index == acc.BalanceHeight {
return nil, nil
}
@ -643,7 +643,7 @@ func (n *NEO) distributeGas(ic *interop.Context, acc *state.NEOBalance) (*big.In
return gen, nil
}
func (n *NEO) unclaimedGas(ic *interop.Context, args []stackitem.Item) stackitem.Item {
func (n *Annos) unclaimedGas(ic *interop.Context, args []stackitem.Item) stackitem.Item {
u := toUint160(args[0])
end := uint32(toBigInt(args[1]).Int64())
gen, err := n.CalculateBonus(ic, u, end)
@ -653,14 +653,14 @@ func (n *NEO) unclaimedGas(ic *interop.Context, args []stackitem.Item) stackitem
return stackitem.NewBigInteger(gen)
}
func (n *NEO) getGASPerBlock(ic *interop.Context, _ []stackitem.Item) stackitem.Item {
func (n *Annos) getGASPerBlock(ic *interop.Context, _ []stackitem.Item) stackitem.Item {
gas := n.GetGASPerBlock(ic.DAO, ic.BlockHeight()+1)
return stackitem.NewBigInteger(gas)
}
func (n *NEO) getSortedGASRecordFromDAO(d *dao.Simple) gasRecord {
func (n *Annos) getSortedGASRecordFromDAO(d *dao.Simple) gasRecord {
var gr = make(gasRecord, 0)
d.Seek(n.ID, storage.SeekRange{Prefix: []byte{prefixGASPerBlock}}, func(k, v []byte) bool {
d.Seek(n.ID, storage.SeekRange{Prefix: []byte{prefixLubPerBlock}}, func(k, v []byte) bool {
gr = append(gr, gasIndexPair{
Index: binary.BigEndian.Uint32(k),
GASPerBlock: *bigint.FromBytes(v),
@ -671,8 +671,8 @@ func (n *NEO) getSortedGASRecordFromDAO(d *dao.Simple) gasRecord {
}
// GetGASPerBlock returns gas generated for block with provided index.
func (n *NEO) GetGASPerBlock(d *dao.Simple, index uint32) *big.Int {
cache := d.GetROCache(n.ID).(*NeoCache)
func (n *Annos) GetGASPerBlock(d *dao.Simple, index uint32) *big.Int {
cache := d.GetROCache(n.ID).(*AnnosCache)
gr := cache.gasPerBlock
for i := len(gr) - 1; i >= 0; i-- {
if gr[i].Index <= index {
@ -680,16 +680,16 @@ func (n *NEO) GetGASPerBlock(d *dao.Simple, index uint32) *big.Int {
return &g
}
}
panic("NEO cache not initialized")
panic("Annos cache not initialized")
}
// GetCommitteeAddress returns address of the committee.
func (n *NEO) GetCommitteeAddress(d *dao.Simple) util.Uint160 {
cache := d.GetROCache(n.ID).(*NeoCache)
func (n *Annos) GetCommitteeAddress(d *dao.Simple) util.Uint160 {
cache := d.GetROCache(n.ID).(*AnnosCache)
return cache.committeeHash
}
func (n *NEO) CheckCommittee(ic *interop.Context) bool {
func (n *Annos) CheckCommittee(ic *interop.Context) bool {
ok, err := runtime.CheckHashedWitness(ic, n.GetCommitteeAddress(ic.DAO))
if err != nil {
panic(err)
@ -697,7 +697,7 @@ func (n *NEO) CheckCommittee(ic *interop.Context) bool {
return ok
}
func (n *NEO) setGASPerBlock(ic *interop.Context, args []stackitem.Item) stackitem.Item {
func (n *Annos) setGASPerBlock(ic *interop.Context, args []stackitem.Item) stackitem.Item {
gas := toBigInt(args[0])
err := n.SetGASPerBlock(ic, ic.Block.Index+1, gas)
if err != nil {
@ -707,15 +707,15 @@ func (n *NEO) setGASPerBlock(ic *interop.Context, args []stackitem.Item) stackit
}
// SetGASPerBlock sets gas generated for blocks after index.
func (n *NEO) SetGASPerBlock(ic *interop.Context, index uint32, gas *big.Int) error {
if gas.Sign() == -1 || gas.Cmp(big.NewInt(10*GASFactor)) == 1 {
func (n *Annos) SetGASPerBlock(ic *interop.Context, index uint32, gas *big.Int) error {
if gas.Sign() == -1 || gas.Cmp(big.NewInt(10*LubFactor)) == 1 {
return errors.New("invalid value for GASPerBlock")
}
if !n.CheckCommittee(ic) {
return errors.New("invalid committee signature")
}
n.putGASRecord(ic.DAO, index, gas)
cache := ic.DAO.GetRWCache(n.ID).(*NeoCache)
cache := ic.DAO.GetRWCache(n.ID).(*AnnosCache)
cache.gasPerBlock = append(cache.gasPerBlock, gasIndexPair{
Index: index,
GASPerBlock: *gas,
@ -723,16 +723,16 @@ func (n *NEO) SetGASPerBlock(ic *interop.Context, index uint32, gas *big.Int) er
return nil
}
func (n *NEO) getRegisterPrice(ic *interop.Context, _ []stackitem.Item) stackitem.Item {
func (n *Annos) getRegisterPrice(ic *interop.Context, _ []stackitem.Item) stackitem.Item {
return stackitem.NewBigInteger(big.NewInt(n.getRegisterPriceInternal(ic.DAO)))
}
func (n *NEO) getRegisterPriceInternal(d *dao.Simple) int64 {
cache := d.GetROCache(n.ID).(*NeoCache)
func (n *Annos) getRegisterPriceInternal(d *dao.Simple) int64 {
cache := d.GetROCache(n.ID).(*AnnosCache)
return cache.registerPrice
}
func (n *NEO) setRegisterPrice(ic *interop.Context, args []stackitem.Item) stackitem.Item {
func (n *Annos) setRegisterPrice(ic *interop.Context, args []stackitem.Item) stackitem.Item {
price := toBigInt(args[0])
if price.Sign() <= 0 || !price.IsInt64() {
panic("invalid register price")
@ -742,12 +742,12 @@ func (n *NEO) setRegisterPrice(ic *interop.Context, args []stackitem.Item) stack
}
setIntWithKey(n.ID, ic.DAO, []byte{prefixRegisterPrice}, price.Int64())
cache := ic.DAO.GetRWCache(n.ID).(*NeoCache)
cache := ic.DAO.GetRWCache(n.ID).(*AnnosCache)
cache.registerPrice = price.Int64()
return stackitem.Null{}
}
func (n *NEO) dropCandidateIfZero(d *dao.Simple, cache *NeoCache, pub *keys.PublicKey, c *candidate) bool {
func (n *Annos) dropCandidateIfZero(d *dao.Simple, cache *AnnosCache, pub *keys.PublicKey, c *candidate) bool {
if c.Registered || c.Votes.Sign() != 0 {
return false
}
@ -772,9 +772,9 @@ func makeVoterKey(pub []byte, prealloc ...[]byte) []byte {
return key
}
// CalculateBonus calculates amount of gas generated for holding value NEO from start to end block
// CalculateBonus calculates amount of Lub generated for holding value Annos from start to end block
// and having voted for active committee member.
func (n *NEO) CalculateBonus(ic *interop.Context, acc util.Uint160, end uint32) (*big.Int, error) {
func (n *Annos) CalculateBonus(ic *interop.Context, acc util.Uint160, end uint32) (*big.Int, error) {
key := makeAccountKey(acc)
si := ic.DAO.GetStorageItem(n.ID, key)
if si == nil {
@ -793,8 +793,8 @@ func (n *NEO) CalculateBonus(ic *interop.Context, acc util.Uint160, end uint32)
return n.calculateBonus(ic.DAO, st, end)
}
func (n *NEO) calculateBonus(d *dao.Simple, acc *state.NEOBalance, end uint32) (*big.Int, error) {
r, err := n.CalculateNEOHolderReward(d, &acc.Balance, acc.BalanceHeight, end)
func (n *Annos) calculateBonus(d *dao.Simple, acc *state.NEOBalance, end uint32) (*big.Int, error) {
r, err := n.CalculateAnnosHolderReward(d, &acc.Balance, acc.BalanceHeight, end)
if err != nil || acc.VoteTo == nil {
return r, err
}
@ -808,14 +808,14 @@ func (n *NEO) calculateBonus(d *dao.Simple, acc *state.NEOBalance, end uint32) (
return tmp, nil
}
// CalculateNEOHolderReward return GAS reward for holding `value` of NEO from start to end block.
func (n *NEO) CalculateNEOHolderReward(d *dao.Simple, value *big.Int, start, end uint32) (*big.Int, error) {
// CalculateAnnosHolderReward return Lub reward for holding `value` of Annos from start to end block.
func (n *Annos) CalculateAnnosHolderReward(d *dao.Simple, value *big.Int, start, end uint32) (*big.Int, error) {
if value.Sign() == 0 || start >= end {
return big.NewInt(0), nil
} else if value.Sign() < 0 {
return nil, errors.New("negative value")
}
cache := d.GetROCache(n.ID).(*NeoCache)
cache := d.GetROCache(n.ID).(*AnnosCache)
gr := cache.gasPerBlock
var sum, tmp big.Int
for i := len(gr) - 1; i >= 0; i-- {
@ -833,12 +833,12 @@ func (n *NEO) CalculateNEOHolderReward(d *dao.Simple, value *big.Int, start, end
end = gr[i].Index
}
res := new(big.Int).Mul(value, &sum)
res.Mul(res, tmp.SetInt64(neoHolderRewardRatio))
res.Div(res, tmp.SetInt64(100*NEOTotalSupply))
res.Mul(res, tmp.SetInt64(annosHolderRewardRatio))
res.Div(res, tmp.SetInt64(100*AnnosTotalSupply))
return res, nil
}
func (n *NEO) registerCandidate(ic *interop.Context, args []stackitem.Item) stackitem.Item {
func (n *Annos) registerCandidate(ic *interop.Context, args []stackitem.Item) stackitem.Item {
pub := toPublicKey(args[0])
if !ic.VM.AddDatoshi(n.getRegisterPriceInternal(ic.DAO)) {
panic("insufficient gas")
@ -847,7 +847,7 @@ func (n *NEO) registerCandidate(ic *interop.Context, args []stackitem.Item) stac
return stackitem.NewBool(err == nil)
}
func (n *NEO) checkRegisterCandidate(ic *interop.Context, pub *keys.PublicKey) error {
func (n *Annos) checkRegisterCandidate(ic *interop.Context, pub *keys.PublicKey) error {
ok, err := runtime.CheckKeyedWitness(ic, pub)
if err != nil {
panic(err)
@ -857,7 +857,7 @@ func (n *NEO) checkRegisterCandidate(ic *interop.Context, pub *keys.PublicKey) e
return n.RegisterCandidateInternal(ic, pub)
}
func (n *NEO) onNEP17Payment(ic *interop.Context, args []stackitem.Item) stackitem.Item {
func (n *Annos) onNEP17Payment(ic *interop.Context, args []stackitem.Item) stackitem.Item {
var (
caller = ic.VM.GetCallingScriptHash()
_ = toUint160(args[0])
@ -866,7 +866,7 @@ func (n *NEO) onNEP17Payment(ic *interop.Context, args []stackitem.Item) stackit
regPrice = n.getRegisterPriceInternal(ic.DAO)
)
if caller != n.GAS.Metadata().Hash {
if caller != n.Lub.Metadata().Hash {
panic("only GAS is accepted")
}
if !amount.IsInt64() || amount.Int64() != regPrice {
@ -876,13 +876,13 @@ func (n *NEO) onNEP17Payment(ic *interop.Context, args []stackitem.Item) stackit
if err != nil {
panic(err)
}
n.GAS.Burn(ic, n.Hash, amount)
n.Lub.Burn(ic, n.Hash, amount)
return stackitem.Null{}
}
// RegisterCandidateInternal registers pub as a new candidate. This method must not be
// called outside of VM since it panics on critical errors.
func (n *NEO) RegisterCandidateInternal(ic *interop.Context, pub *keys.PublicKey) error {
func (n *Annos) RegisterCandidateInternal(ic *interop.Context, pub *keys.PublicKey) error {
var emitEvent = true
key := makeValidatorKey(pub)
@ -900,7 +900,7 @@ func (n *NEO) RegisterCandidateInternal(ic *interop.Context, pub *keys.PublicKey
return err
}
if emitEvent {
cache := ic.DAO.GetRWCache(n.ID).(*NeoCache)
cache := ic.DAO.GetRWCache(n.ID).(*AnnosCache)
cache.votesChanged = true
err = ic.AddNotification(n.Hash, "CandidateStateChanged", stackitem.NewArray([]stackitem.Item{
stackitem.NewByteArray(pub.Bytes()),
@ -915,7 +915,7 @@ func (n *NEO) RegisterCandidateInternal(ic *interop.Context, pub *keys.PublicKey
return nil
}
func (n *NEO) unregisterCandidate(ic *interop.Context, args []stackitem.Item) stackitem.Item {
func (n *Annos) unregisterCandidate(ic *interop.Context, args []stackitem.Item) stackitem.Item {
pub := toPublicKey(args[0])
ok, err := runtime.CheckKeyedWitness(ic, pub)
if err != nil {
@ -929,7 +929,7 @@ func (n *NEO) unregisterCandidate(ic *interop.Context, args []stackitem.Item) st
// UnregisterCandidateInternal unregisters pub as a candidate. This method must not be
// called outside of VM since it panics on critical errors.
func (n *NEO) UnregisterCandidateInternal(ic *interop.Context, pub *keys.PublicKey) error {
func (n *Annos) UnregisterCandidateInternal(ic *interop.Context, pub *keys.PublicKey) error {
var err error
key := makeValidatorKey(pub)
@ -937,7 +937,7 @@ func (n *NEO) UnregisterCandidateInternal(ic *interop.Context, pub *keys.PublicK
if si == nil {
return nil
}
cache := ic.DAO.GetRWCache(n.ID).(*NeoCache)
cache := ic.DAO.GetRWCache(n.ID).(*AnnosCache)
// Not only current committee/validators cache is interested in votesChanged, but also
// newEpoch cache, thus, modify votesChanged to update the latter.
cache.votesChanged = true
@ -965,7 +965,7 @@ func (n *NEO) UnregisterCandidateInternal(ic *interop.Context, pub *keys.PublicK
return nil
}
func (n *NEO) vote(ic *interop.Context, args []stackitem.Item) stackitem.Item {
func (n *Annos) vote(ic *interop.Context, args []stackitem.Item) stackitem.Item {
acc := toUint160(args[0])
var pub *keys.PublicKey
if _, ok := args[1].(stackitem.Null); !ok {
@ -977,7 +977,7 @@ func (n *NEO) vote(ic *interop.Context, args []stackitem.Item) stackitem.Item {
// VoteInternal votes from account h for validarors specified in pubs. This method
// must not be called outside of VM since it panics on critical errors.
func (n *NEO) VoteInternal(ic *interop.Context, h util.Uint160, pub *keys.PublicKey) error {
func (n *Annos) VoteInternal(ic *interop.Context, h util.Uint160, pub *keys.PublicKey) error {
ok, err := runtime.CheckHashedWitness(ic, h)
if err != nil {
return err
@ -987,15 +987,15 @@ func (n *NEO) VoteInternal(ic *interop.Context, h util.Uint160, pub *keys.Public
return n.voteInternalUnchecked(ic, h, pub)
}
// RevokeVotes implements INEO interface. It revokes votes of account h and
// RevokeVotes implements IAnnos interface. It revokes votes of account h and
// doesn't check the h's witness.
func (n *NEO) RevokeVotes(ic *interop.Context, h util.Uint160) error {
func (n *Annos) RevokeVotes(ic *interop.Context, h util.Uint160) error {
return n.voteInternalUnchecked(ic, h, nil)
}
// VoteInternalUnchecked it's an internal representation of VoteInternal that
// votes of the specified account without checking the voter's signature.
func (n *NEO) voteInternalUnchecked(ic *interop.Context, h util.Uint160, pub *keys.PublicKey) error {
func (n *Annos) voteInternalUnchecked(ic *interop.Context, h util.Uint160, pub *keys.PublicKey) error {
key := makeAccountKey(h)
si := ic.DAO.GetStorageItem(n.ID, key)
if si == nil {
@ -1062,7 +1062,7 @@ func (n *NEO) voteInternalUnchecked(ic *interop.Context, h util.Uint160, pub *ke
}
if newGas != nil { // Can be if it was already distributed in the same block.
n.GAS.Mint(ic, h, newGas, true)
n.Lub.Mint(ic, h, newGas, true)
}
return nil
}
@ -1076,8 +1076,8 @@ func keyToStackItem(k *keys.PublicKey) stackitem.Item {
// ModifyAccountVotes modifies votes of the specified account by value (can be negative).
// typ specifies if this modify is occurring during transfer or vote (with old or new validator).
func (n *NEO) ModifyAccountVotes(acc *state.NEOBalance, d *dao.Simple, value *big.Int, isNewVote bool) error {
cache := d.GetRWCache(n.ID).(*NeoCache)
func (n *Annos) ModifyAccountVotes(acc *state.NEOBalance, d *dao.Simple, value *big.Int, isNewVote bool) error {
cache := d.GetRWCache(n.ID).(*AnnosCache)
cache.votesChanged = true
if acc.VoteTo != nil {
key := makeValidatorKey(acc.VoteTo)
@ -1098,7 +1098,7 @@ func (n *NEO) ModifyAccountVotes(acc *state.NEOBalance, d *dao.Simple, value *bi
return nil
}
func (n *NEO) getCandidates(d *dao.Simple, sortByKey bool, maxNum int) ([]keyWithVotes, error) {
func (n *Annos) getCandidates(d *dao.Simple, sortByKey bool, maxNum int) ([]keyWithVotes, error) {
arr := make([]keyWithVotes, 0)
buf := io.NewBufBinWriter()
d.Seek(n.ID, storage.SeekRange{Prefix: []byte{prefixCandidate}}, func(k, v []byte) bool {
@ -1139,7 +1139,7 @@ func (n *NEO) getCandidates(d *dao.Simple, sortByKey bool, maxNum int) ([]keyWit
// GetCandidates returns current registered validators list with keys
// and votes.
func (n *NEO) GetCandidates(d *dao.Simple) ([]state.Validator, error) {
func (n *Annos) GetCandidates(d *dao.Simple) ([]state.Validator, error) {
kvs, err := n.getCandidates(d, true, maxGetCandidatesRespLen)
if err != nil {
return nil, err
@ -1155,7 +1155,7 @@ func (n *NEO) GetCandidates(d *dao.Simple) ([]state.Validator, error) {
return arr, nil
}
func (n *NEO) getCandidatesCall(ic *interop.Context, _ []stackitem.Item) stackitem.Item {
func (n *Annos) getCandidatesCall(ic *interop.Context, _ []stackitem.Item) stackitem.Item {
validators, err := n.getCandidates(ic.DAO, true, maxGetCandidatesRespLen)
if err != nil {
panic(err)
@ -1170,11 +1170,11 @@ func (n *NEO) getCandidatesCall(ic *interop.Context, _ []stackitem.Item) stackit
return stackitem.NewArray(arr)
}
func (n *NEO) getCommitteeAddress(ic *interop.Context, _ []stackitem.Item) stackitem.Item {
func (n *Annos) getCommitteeAddress(ic *interop.Context, _ []stackitem.Item) stackitem.Item {
return stackitem.NewByteArray(n.GetCommitteeAddress(ic.DAO).BytesBE())
}
func (n *NEO) getAllCandidatesCall(ic *interop.Context, _ []stackitem.Item) stackitem.Item {
func (n *Annos) getAllCandidatesCall(ic *interop.Context, _ []stackitem.Item) stackitem.Item {
ctx, cancel := context.WithCancel(context.Background())
prefix := []byte{prefixCandidate}
buf := io.NewBufBinWriter()
@ -1214,7 +1214,7 @@ func (n *NEO) getAllCandidatesCall(ic *interop.Context, _ []stackitem.Item) stac
return stackitem.NewInterop(item)
}
func (n *NEO) getCandidateVoteCall(ic *interop.Context, args []stackitem.Item) stackitem.Item {
func (n *Annos) getCandidateVoteCall(ic *interop.Context, args []stackitem.Item) stackitem.Item {
pub := toPublicKey(args[0])
key := makeValidatorKey(pub)
si := ic.DAO.GetStorageItem(n.ID, key)
@ -1228,7 +1228,7 @@ func (n *NEO) getCandidateVoteCall(ic *interop.Context, args []stackitem.Item) s
return stackitem.NewBigInteger(&c.Votes)
}
func (n *NEO) getAccountState(ic *interop.Context, args []stackitem.Item) stackitem.Item {
func (n *Annos) getAccountState(ic *interop.Context, args []stackitem.Item) stackitem.Item {
key := makeAccountKey(toUint160(args[0]))
si := ic.DAO.GetStorageItem(n.ID, key)
if len(si) == 0 {
@ -1248,10 +1248,10 @@ func (n *NEO) getAccountState(ic *interop.Context, args []stackitem.Item) stacki
// Note: this method isn't actually "computes" new committee list and calculates
// new validators list from it. Instead, it uses cache, and the cache itself is
// updated during the PostPersist of the last block of every epoch.
func (n *NEO) ComputeNextBlockValidators(d *dao.Simple) keys.PublicKeys {
func (n *Annos) ComputeNextBlockValidators(d *dao.Simple) keys.PublicKeys {
// It should always be OK with RO cache if using lower-layered DAO with proper
// cache set.
cache := d.GetROCache(n.ID).(*NeoCache)
cache := d.GetROCache(n.ID).(*AnnosCache)
if vals := cache.newEpochNextValidators; vals != nil {
return vals.Copy()
}
@ -1262,13 +1262,13 @@ func (n *NEO) ComputeNextBlockValidators(d *dao.Simple) keys.PublicKeys {
panic("bug: unexpected external call to newEpochNextValidators cache")
}
func (n *NEO) getCommittee(ic *interop.Context, _ []stackitem.Item) stackitem.Item {
func (n *Annos) getCommittee(ic *interop.Context, _ []stackitem.Item) stackitem.Item {
pubs := n.GetCommitteeMembers(ic.DAO)
slices.SortFunc(pubs, (*keys.PublicKey).Cmp)
return pubsToArray(pubs)
}
func (n *NEO) modifyVoterTurnout(d *dao.Simple, amount *big.Int) error {
func (n *Annos) modifyVoterTurnout(d *dao.Simple, amount *big.Int) error {
key := []byte{prefixVotersCount}
si := d.GetStorageItem(n.ID, key)
if si == nil {
@ -1281,8 +1281,8 @@ func (n *NEO) modifyVoterTurnout(d *dao.Simple, amount *big.Int) error {
}
// GetCommitteeMembers returns public keys of nodes in committee using cached value.
func (n *NEO) GetCommitteeMembers(d *dao.Simple) keys.PublicKeys {
cache := d.GetROCache(n.ID).(*NeoCache)
func (n *Annos) GetCommitteeMembers(d *dao.Simple) keys.PublicKeys {
cache := d.GetROCache(n.ID).(*AnnosCache)
return getCommitteeMembers(cache.committee)
}
@ -1309,7 +1309,7 @@ func toKeysWithVotes(pubs keys.PublicKeys) keysWithVotes {
}
// computeCommitteeMembers returns public keys of nodes in committee.
func (n *NEO) computeCommitteeMembers(blockHeight uint32, d *dao.Simple) (keys.PublicKeys, keysWithVotes, error) {
func (n *Annos) computeCommitteeMembers(blockHeight uint32, d *dao.Simple) (keys.PublicKeys, keysWithVotes, error) {
key := []byte{prefixVotersCount}
si := d.GetStorageItem(n.ID, key)
if si == nil {
@ -1354,19 +1354,19 @@ func (n *NEO) computeCommitteeMembers(blockHeight uint32, d *dao.Simple) (keys.P
return pubs, cs[:count], nil
}
func (n *NEO) getNextBlockValidators(ic *interop.Context, _ []stackitem.Item) stackitem.Item {
func (n *Annos) getNextBlockValidators(ic *interop.Context, _ []stackitem.Item) stackitem.Item {
result := n.GetNextBlockValidatorsInternal(ic.DAO)
return pubsToArray(result)
}
// GetNextBlockValidatorsInternal returns next block validators.
func (n *NEO) GetNextBlockValidatorsInternal(d *dao.Simple) keys.PublicKeys {
cache := d.GetROCache(n.ID).(*NeoCache)
func (n *Annos) GetNextBlockValidatorsInternal(d *dao.Simple) keys.PublicKeys {
cache := d.GetROCache(n.ID).(*AnnosCache)
return cache.nextValidators.Copy()
}
// BalanceOf returns native NEO token balance for the acc.
func (n *NEO) BalanceOf(d *dao.Simple, acc util.Uint160) (*big.Int, uint32) {
// BalanceOf returns native Annos token balance for the acc.
func (n *Annos) BalanceOf(d *dao.Simple, acc util.Uint160) (*big.Int, uint32) {
key := makeAccountKey(acc)
si := d.GetStorageItem(n.ID, key)
if si == nil {
@ -1374,7 +1374,7 @@ func (n *NEO) BalanceOf(d *dao.Simple, acc util.Uint160) (*big.Int, uint32) {
}
st, err := state.NEOBalanceFromBytes(si)
if err != nil {
panic(fmt.Errorf("failed to decode NEO balance state: %w", err))
panic(fmt.Errorf("failed to decode Annos balance state: %w", err))
}
return &st.Balance, st.BalanceHeight
}
@ -1400,9 +1400,9 @@ func toPublicKey(s stackitem.Item) *keys.PublicKey {
}
// putGASRecord is a helper which creates key and puts GASPerBlock value into the storage.
func (n *NEO) putGASRecord(dao *dao.Simple, index uint32, value *big.Int) {
func (n *Annos) putGASRecord(dao *dao.Simple, index uint32, value *big.Int) {
key := make([]byte, 5)
key[0] = prefixGASPerBlock
key[0] = prefixLubPerBlock
binary.BigEndian.PutUint32(key[1:], index)
dao.PutBigInt(n.ID, key, value)
}

View File

@ -17,10 +17,10 @@ import (
"github.com/tutus-one/tutus-chain/pkg/util"
)
// GAS represents GAS native contract.
type GAS struct {
// Lub represents Lub native contract (utility/fee token - lubrication).
type Lub struct {
nep17TokenNative
NEO INEO
Annos IAnnos
Policy IPolicy
Vita IVita // For checking local Vita status
Federation IFederation // For visiting Vita and fee split
@ -44,20 +44,20 @@ const (
VitaExemptAsylum
)
// GASFactor is a divisor for finding GAS integral value.
const GASFactor = NEOTotalSupply
// LubFactor is a divisor for finding Lub integral value.
const LubFactor = AnnosTotalSupply
// newGAS returns GAS native contract.
func newGAS(init int64) *GAS {
g := &GAS{
// newLub returns Lub native contract.
func newLub(init int64) *Lub {
g := &Lub{
initialSupply: init,
}
defer g.BuildHFSpecificMD(g.ActiveIn())
nep17 := newNEP17Native(nativenames.Gas, nativeids.GasToken, nil)
nep17.symbol = "GAS"
nep17 := newNEP17Native(nativenames.Lub, nativeids.Lub, nil)
nep17.symbol = "LUB"
nep17.decimals = 8
nep17.factor = GASFactor
nep17.factor = LubFactor
nep17.incBalance = g.increaseBalance
nep17.balFromBytes = g.balanceFromBytes
@ -66,7 +66,7 @@ func newGAS(init int64) *GAS {
return g
}
func (g *GAS) increaseBalance(_ *interop.Context, _ util.Uint160, si *state.StorageItem, amount *big.Int, checkBal *big.Int) (func(), error) {
func (g *Lub) increaseBalance(_ *interop.Context, _ util.Uint160, si *state.StorageItem, amount *big.Int, checkBal *big.Int) (func(), error) {
acc, err := state.NEP17BalanceFromBytes(*si)
if err != nil {
return nil, err
@ -89,7 +89,7 @@ func (g *GAS) increaseBalance(_ *interop.Context, _ util.Uint160, si *state.Stor
return nil, nil
}
func (g *GAS) balanceFromBytes(si *state.StorageItem) (*big.Int, error) {
func (g *Lub) balanceFromBytes(si *state.StorageItem) (*big.Int, error) {
acc, err := state.NEP17BalanceFromBytes(*si)
if err != nil {
return nil, err
@ -97,8 +97,8 @@ func (g *GAS) balanceFromBytes(si *state.StorageItem) (*big.Int, error) {
return &acc.Balance, err
}
// Initialize initializes a GAS contract.
func (g *GAS) Initialize(ic *interop.Context, hf *config.Hardfork, newMD *interop.HFSpecificContractMD) error {
// Initialize initializes a Lub contract.
func (g *Lub) Initialize(ic *interop.Context, hf *config.Hardfork, newMD *interop.HFSpecificContractMD) error {
if hf != g.ActiveIn() {
return nil
}
@ -119,12 +119,12 @@ func (g *GAS) Initialize(ic *interop.Context, hf *config.Hardfork, newMD *intero
}
// InitializeCache implements the Contract interface.
func (g *GAS) InitializeCache(_ interop.IsHardforkEnabled, blockHeight uint32, d *dao.Simple) error {
func (g *Lub) InitializeCache(_ interop.IsHardforkEnabled, blockHeight uint32, d *dao.Simple) error {
return nil
}
// OnPersist implements the Contract interface.
func (g *GAS) OnPersist(ic *interop.Context) error {
func (g *Lub) OnPersist(ic *interop.Context) error {
if len(ic.Block.Transactions) == 0 {
return nil
}
@ -155,7 +155,7 @@ func (g *GAS) OnPersist(ic *interop.Context) error {
g.Burn(ic, sender, absAmount)
}
}
validators := g.NEO.GetNextBlockValidatorsInternal(ic.DAO)
validators := g.Annos.GetNextBlockValidatorsInternal(ic.DAO)
primary := validators[ic.Block.PrimaryIndex].GetScriptHash()
var netFee int64
for _, tx := range ic.Block.Transactions {
@ -173,12 +173,12 @@ func (g *GAS) OnPersist(ic *interop.Context) error {
}
// PostPersist implements the Contract interface.
func (g *GAS) PostPersist(ic *interop.Context) error {
func (g *Lub) PostPersist(ic *interop.Context) error {
return nil
}
// getVitaExemptType determines if sender is exempt from fees and what type.
func (g *GAS) getVitaExemptType(d *dao.Simple, sender util.Uint160) VitaExemptType {
func (g *Lub) getVitaExemptType(d *dao.Simple, sender util.Uint160) VitaExemptType {
// Check local Vita first
if g.Vita != nil {
token, err := g.Vita.GetTokenByOwner(d, sender)
@ -206,13 +206,13 @@ func (g *GAS) getVitaExemptType(d *dao.Simple, sender util.Uint160) VitaExemptTy
return VitaExemptNone
}
// burnFromTreasury burns GAS from Treasury for local Vita holders (100% local).
func (g *GAS) burnFromTreasury(ic *interop.Context, amount *big.Int) {
// burnFromTreasury burns Lub from Treasury for local Vita holders (100% local).
func (g *Lub) burnFromTreasury(ic *interop.Context, amount *big.Int) {
g.burnFromTreasuryInternal(ic, amount, 100, 0)
}
// burnFromTreasuryWithSplit burns GAS with visiting fee split between local Treasury and inter-chain debt.
func (g *GAS) burnFromTreasuryWithSplit(ic *interop.Context, amount *big.Int, homeChain uint32) {
// burnFromTreasuryWithSplit burns Lub with visiting fee split between local Treasury and inter-chain debt.
func (g *Lub) burnFromTreasuryWithSplit(ic *interop.Context, amount *big.Int, homeChain uint32) {
localPercent := uint8(100)
if g.Federation != nil {
localPercent = g.Federation.GetVisitingFeePercent(ic.DAO)
@ -221,7 +221,7 @@ func (g *GAS) burnFromTreasuryWithSplit(ic *interop.Context, amount *big.Int, ho
}
// burnFromTreasuryInternal handles the actual burn with optional split between local and inter-chain.
func (g *GAS) burnFromTreasuryInternal(ic *interop.Context, amount *big.Int, localPercent uint8, homeChain uint32) {
func (g *Lub) burnFromTreasuryInternal(ic *interop.Context, amount *big.Int, localPercent uint8, homeChain uint32) {
if g.Treasury == nil {
return
}
@ -252,12 +252,12 @@ func (g *GAS) burnFromTreasuryInternal(ic *interop.Context, amount *big.Int, loc
}
// ActiveIn implements the Contract interface.
func (g *GAS) ActiveIn() *config.Hardfork {
func (g *Lub) ActiveIn() *config.Hardfork {
return nil
}
// BalanceOf returns native GAS token balance for the acc.
func (g *GAS) BalanceOf(d *dao.Simple, acc util.Uint160) *big.Int {
// BalanceOf returns native Lub token balance for the acc.
func (g *Lub) BalanceOf(d *dao.Simple, acc util.Uint160) *big.Int {
return g.balanceOfInternal(d, acc)
}

View File

@ -31,7 +31,7 @@ func TestCryptoLib_KoblitzVerificationScript(t *testing.T) {
buildVerificationScript func(t *testing.T, pub *keys.PublicKey) []byte,
constructMsg func(t *testing.T, magic uint32, tx hash.Hashable) []byte,
) {
c := newGasClient(t)
c := newLubClient(t)
gasInvoker := c.WithSigners(c.Committee)
e := c.Executor
@ -586,7 +586,7 @@ func TestCryptoLib_KoblitzMultisigVerificationScript(t *testing.T) {
buildVerificationScript func(t *testing.T, m int, pub keys.PublicKeys) []byte,
constructMsg func(t *testing.T, magic uint32, tx hash.Hashable) []byte,
) {
c := newGasClient(t)
c := newLubClient(t)
gasInvoker := c.WithSigners(c.Committee)
e := c.Executor

View File

@ -17,12 +17,12 @@ import (
"github.com/stretchr/testify/require"
)
func newGasClient(t *testing.T) *neotest.ContractInvoker {
return newNativeClient(t, nativenames.Gas)
func newLubClient(t *testing.T) *neotest.ContractInvoker {
return newNativeClient(t, nativenames.Lub)
}
func TestGAS_Roundtrip(t *testing.T) {
c := newGasClient(t)
func TestLub_Roundtrip(t *testing.T) {
c := newLubClient(t)
e := c.Executor
gasInvoker := c.WithSigners(c.NewAccount(t))
owner := gasInvoker.Signers[0].ScriptHash()
@ -30,7 +30,7 @@ func TestGAS_Roundtrip(t *testing.T) {
getUtilityTokenBalance := func(acc util.Uint160) (*big.Int, uint32) {
lub, err := e.Chain.GetTokenLastUpdated(acc)
require.NoError(t, err)
return e.Chain.GetUtilityTokenBalance(acc), lub[e.NativeID(t, nativenames.Gas)]
return e.Chain.GetUtilityTokenBalance(acc), lub[e.NativeID(t, nativenames.Lub)]
}
initialBalance, _ := getUtilityTokenBalance(owner)
@ -59,7 +59,7 @@ func TestGAS_Roundtrip(t *testing.T) {
})
}
func TestGAS_RewardWithP2PSigExtensionsEnabled(t *testing.T) {
func TestLub_RewardWithP2PSigExtensionsEnabled(t *testing.T) {
const (
nNotaries = 2
nKeys = 4
@ -75,12 +75,12 @@ func TestGAS_RewardWithP2PSigExtensionsEnabled(t *testing.T) {
}
})
e := neotest.NewExecutor(t, bc, validator, committee)
gasCommitteeInvoker := e.CommitteeInvoker(e.NativeHash(t, nativenames.Gas))
lubCommitteeInvoker := e.CommitteeInvoker(e.NativeHash(t, nativenames.Lub))
notaryHash := e.NativeHash(t, nativenames.Notary)
notaryServiceFeePerKey := e.Chain.GetNotaryServiceFeePerKey()
// transfer funds to committee
e.ValidatorInvoker(e.NativeHash(t, nativenames.Gas)).Invoke(t, true, "transfer", e.Validator.ScriptHash(), e.CommitteeHash, 1000_0000_0000, nil)
e.ValidatorInvoker(e.NativeHash(t, nativenames.Lub)).Invoke(t, true, "transfer", e.Validator.ScriptHash(), e.CommitteeHash, 1000_0000_0000, nil)
// set Notary nodes and check their balance
notaryNodes := make([]*keys.PrivateKey, nNotaries)
@ -96,17 +96,17 @@ func TestGAS_RewardWithP2PSigExtensionsEnabled(t *testing.T) {
e.CheckGASBalance(t, notaryNode.GetScriptHash(), big.NewInt(0))
}
// deposit GAS for `signer` with lock until the next block (inclusively)
// deposit Lub for `signer` with lock until the next block (inclusively)
depositAmount := 100_0000 + (2+int64(nKeys))*notaryServiceFeePerKey // sysfee + netfee of the next transaction
gasCommitteeInvoker.Invoke(t, true, "transfer", e.CommitteeHash, notaryHash, depositAmount, []any{e.CommitteeHash, e.Chain.BlockHeight() + 2})
lubCommitteeInvoker.Invoke(t, true, "transfer", e.CommitteeHash, notaryHash, depositAmount, []any{e.CommitteeHash, e.Chain.BlockHeight() + 2})
// save initial GAS total supply
getGASTS := func(t *testing.T) int64 {
stack, err := gasCommitteeInvoker.TestInvoke(t, "totalSupply")
// save initial Lub total supply
getLubTS := func(t *testing.T) int64 {
stack, err := lubCommitteeInvoker.TestInvoke(t, "totalSupply")
require.NoError(t, err)
return stack.Pop().Value().(*big.Int).Int64()
}
tsInitial := getGASTS(t)
tsInitial := getLubTS(t)
// send transaction with Notary contract as a sender
tx := transaction.New([]byte{byte(opcode.PUSH1)}, 1_000_000)
@ -140,15 +140,15 @@ func TestGAS_RewardWithP2PSigExtensionsEnabled(t *testing.T) {
for _, notaryNode := range notaryNodes {
e.CheckGASBalance(t, notaryNode.GetScriptHash(), big.NewInt(notaryServiceFeePerKey*(nKeys+1)/nNotaries))
}
tsUpdated := getGASTS(t)
tsUpdated := getLubTS(t)
tsExpected := tsInitial + 5000_0000 - tx.SystemFee
require.Equal(t, tsExpected, tsUpdated)
}
// TestGAS_TransferNegative ensures that transfer of a negative GAS amount leads to
// TestLub_TransferNegative ensures that transfer of a negative Lub amount leads to
// a VM FAULT, ref. #4072.
func TestGas_TransferNegative(t *testing.T) {
c := newGasClient(t)
func TestLub_TransferNegative(t *testing.T) {
c := newLubClient(t)
acc := c.NewAccount(t)
gasInvoker := c.WithSigners(acc)
gasInvoker.InvokeFail(t, "negative amount", "transfer", acc.ScriptHash(), acc.ScriptHash(), -1, nil)

View File

@ -46,8 +46,8 @@ var (
nativenames.StdLib: `{"id":-2,"hash":"0xacce6fd80d44e1796aa0c2c625e9e4e0ce39efc0","nef":{"magic":860243278,"compiler":"neo-core-v3.0","source":"","tokens":[],"script":"EEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dA","checksum":1991619121},"manifest":{"name":"StdLib","abi":{"methods":[{"name":"atoi","offset":0,"parameters":[{"name":"value","type":"String"}],"returntype":"Integer","safe":true},{"name":"atoi","offset":7,"parameters":[{"name":"value","type":"String"},{"name":"base","type":"Integer"}],"returntype":"Integer","safe":true},{"name":"base58CheckDecode","offset":14,"parameters":[{"name":"s","type":"String"}],"returntype":"ByteArray","safe":true},{"name":"base58CheckEncode","offset":21,"parameters":[{"name":"data","type":"ByteArray"}],"returntype":"String","safe":true},{"name":"base58Decode","offset":28,"parameters":[{"name":"s","type":"String"}],"returntype":"ByteArray","safe":true},{"name":"base58Encode","offset":35,"parameters":[{"name":"data","type":"ByteArray"}],"returntype":"String","safe":true},{"name":"base64Decode","offset":42,"parameters":[{"name":"s","type":"String"}],"returntype":"ByteArray","safe":true},{"name":"base64Encode","offset":49,"parameters":[{"name":"data","type":"ByteArray"}],"returntype":"String","safe":true},{"name":"deserialize","offset":56,"parameters":[{"name":"data","type":"ByteArray"}],"returntype":"Any","safe":true},{"name":"itoa","offset":63,"parameters":[{"name":"value","type":"Integer"}],"returntype":"String","safe":true},{"name":"itoa","offset":70,"parameters":[{"name":"value","type":"Integer"},{"name":"base","type":"Integer"}],"returntype":"String","safe":true},{"name":"jsonDeserialize","offset":77,"parameters":[{"name":"json","type":"ByteArray"}],"returntype":"Any","safe":true},{"name":"jsonSerialize","offset":84,"parameters":[{"name":"item","type":"Any"}],"returntype":"ByteArray","safe":true},{"name":"memoryCompare","offset":91,"parameters":[{"name":"str1","type":"ByteArray"},{"name":"str2","type":"ByteArray"}],"returntype":"Integer","safe":true},{"name":"memorySearch","offset":98,"parameters":[{"name":"mem","type":"ByteArray"},{"name":"value","type":"ByteArray"}],"returntype":"Integer","safe":true},{"name":"memorySearch","offset":105,"parameters":[{"name":"mem","type":"ByteArray"},{"name":"value","type":"ByteArray"},{"name":"start","type":"Integer"}],"returntype":"Integer","safe":true},{"name":"memorySearch","offset":112,"parameters":[{"name":"mem","type":"ByteArray"},{"name":"value","type":"ByteArray"},{"name":"start","type":"Integer"},{"name":"backward","type":"Boolean"}],"returntype":"Integer","safe":true},{"name":"serialize","offset":119,"parameters":[{"name":"item","type":"Any"}],"returntype":"ByteArray","safe":true},{"name":"strLen","offset":126,"parameters":[{"name":"str","type":"String"}],"returntype":"Integer","safe":true},{"name":"stringSplit","offset":133,"parameters":[{"name":"str","type":"String"},{"name":"separator","type":"String"}],"returntype":"Array","safe":true},{"name":"stringSplit","offset":140,"parameters":[{"name":"str","type":"String"},{"name":"separator","type":"String"},{"name":"removeEmptyEntries","type":"Boolean"}],"returntype":"Array","safe":true}],"events":[]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":[],"trusts":[],"extra":null},"updatecounter":0}`,
nativenames.CryptoLib: `{"id":-3,"hash":"0x726cb6e0cd8628a1350a611384688911ab75f51b","nef":{"magic":860243278,"compiler":"neo-core-v3.0","source":"","tokens":[],"script":"EEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQA==","checksum":2135988409},"manifest":{"name":"CryptoLib","abi":{"methods":[{"name":"bls12381Add","offset":0,"parameters":[{"name":"x","type":"InteropInterface"},{"name":"y","type":"InteropInterface"}],"returntype":"InteropInterface","safe":true},{"name":"bls12381Deserialize","offset":7,"parameters":[{"name":"data","type":"ByteArray"}],"returntype":"InteropInterface","safe":true},{"name":"bls12381Equal","offset":14,"parameters":[{"name":"x","type":"InteropInterface"},{"name":"y","type":"InteropInterface"}],"returntype":"Boolean","safe":true},{"name":"bls12381Mul","offset":21,"parameters":[{"name":"x","type":"InteropInterface"},{"name":"mul","type":"ByteArray"},{"name":"neg","type":"Boolean"}],"returntype":"InteropInterface","safe":true},{"name":"bls12381Pairing","offset":28,"parameters":[{"name":"g1","type":"InteropInterface"},{"name":"g2","type":"InteropInterface"}],"returntype":"InteropInterface","safe":true},{"name":"bls12381Serialize","offset":35,"parameters":[{"name":"g","type":"InteropInterface"}],"returntype":"ByteArray","safe":true},{"name":"murmur32","offset":42,"parameters":[{"name":"data","type":"ByteArray"},{"name":"seed","type":"Integer"}],"returntype":"ByteArray","safe":true},{"name":"ripemd160","offset":49,"parameters":[{"name":"data","type":"ByteArray"}],"returntype":"ByteArray","safe":true},{"name":"sha256","offset":56,"parameters":[{"name":"data","type":"ByteArray"}],"returntype":"ByteArray","safe":true},{"name":"verifyWithECDsa","offset":63,"parameters":[{"name":"message","type":"ByteArray"},{"name":"pubkey","type":"ByteArray"},{"name":"signature","type":"ByteArray"},{"name":"curve","type":"Integer"}],"returntype":"Boolean","safe":true}],"events":[]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":[],"trusts":[],"extra":null},"updatecounter":0}`,
nativenames.Ledger: `{"id":-4,"hash":"0xda65b600f7124ce6c79950c1772a36403104f2be","nef":{"magic":860243278,"compiler":"neo-core-v3.0","source":"","tokens":[],"script":"EEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0A=","checksum":1110259869},"manifest":{"name":"LedgerContract","abi":{"methods":[{"name":"currentHash","offset":0,"parameters":[],"returntype":"Hash256","safe":true},{"name":"currentIndex","offset":7,"parameters":[],"returntype":"Integer","safe":true},{"name":"getBlock","offset":14,"parameters":[{"name":"indexOrHash","type":"ByteArray"}],"returntype":"Array","safe":true},{"name":"getTransaction","offset":21,"parameters":[{"name":"hash","type":"Hash256"}],"returntype":"Array","safe":true},{"name":"getTransactionFromBlock","offset":28,"parameters":[{"name":"blockIndexOrHash","type":"ByteArray"},{"name":"txIndex","type":"Integer"}],"returntype":"Array","safe":true},{"name":"getTransactionHeight","offset":35,"parameters":[{"name":"hash","type":"Hash256"}],"returntype":"Integer","safe":true},{"name":"getTransactionSigners","offset":42,"parameters":[{"name":"hash","type":"Hash256"}],"returntype":"Array","safe":true},{"name":"getTransactionVMState","offset":49,"parameters":[{"name":"hash","type":"Hash256"}],"returntype":"Integer","safe":true}],"events":[]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":[],"trusts":[],"extra":null},"updatecounter":0}`,
nativenames.Neo: `{"id":-5,"hash":"0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5","nef":{"magic":860243278,"compiler":"neo-core-v3.0","source":"","tokens":[],"script":"EEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQA==","checksum":65467259},"manifest":{"name":"NeoToken","abi":{"methods":[{"name":"balanceOf","offset":0,"parameters":[{"name":"account","type":"Hash160"}],"returntype":"Integer","safe":true},{"name":"decimals","offset":7,"parameters":[],"returntype":"Integer","safe":true},{"name":"getAccountState","offset":14,"parameters":[{"name":"account","type":"Hash160"}],"returntype":"Array","safe":true},{"name":"getAllCandidates","offset":21,"parameters":[],"returntype":"InteropInterface","safe":true},{"name":"getCandidateVote","offset":28,"parameters":[{"name":"pubKey","type":"PublicKey"}],"returntype":"Integer","safe":true},{"name":"getCandidates","offset":35,"parameters":[],"returntype":"Array","safe":true},{"name":"getCommittee","offset":42,"parameters":[],"returntype":"Array","safe":true},{"name":"getGasPerBlock","offset":49,"parameters":[],"returntype":"Integer","safe":true},{"name":"getNextBlockValidators","offset":56,"parameters":[],"returntype":"Array","safe":true},{"name":"getRegisterPrice","offset":63,"parameters":[],"returntype":"Integer","safe":true},{"name":"registerCandidate","offset":70,"parameters":[{"name":"pubkey","type":"PublicKey"}],"returntype":"Boolean","safe":false},{"name":"setGasPerBlock","offset":77,"parameters":[{"name":"gasPerBlock","type":"Integer"}],"returntype":"Void","safe":false},{"name":"setRegisterPrice","offset":84,"parameters":[{"name":"registerPrice","type":"Integer"}],"returntype":"Void","safe":false},{"name":"symbol","offset":91,"parameters":[],"returntype":"String","safe":true},{"name":"totalSupply","offset":98,"parameters":[],"returntype":"Integer","safe":true},{"name":"transfer","offset":105,"parameters":[{"name":"from","type":"Hash160"},{"name":"to","type":"Hash160"},{"name":"amount","type":"Integer"},{"name":"data","type":"Any"}],"returntype":"Boolean","safe":false},{"name":"unclaimedGas","offset":112,"parameters":[{"name":"account","type":"Hash160"},{"name":"end","type":"Integer"}],"returntype":"Integer","safe":true},{"name":"unregisterCandidate","offset":119,"parameters":[{"name":"pubkey","type":"PublicKey"}],"returntype":"Boolean","safe":false},{"name":"vote","offset":126,"parameters":[{"name":"account","type":"Hash160"},{"name":"voteTo","type":"PublicKey"}],"returntype":"Boolean","safe":false}],"events":[{"name":"Transfer","parameters":[{"name":"from","type":"Hash160"},{"name":"to","type":"Hash160"},{"name":"amount","type":"Integer"}]},{"name":"CandidateStateChanged","parameters":[{"name":"pubkey","type":"PublicKey"},{"name":"registered","type":"Boolean"},{"name":"votes","type":"Integer"}]},{"name":"Vote","parameters":[{"name":"account","type":"Hash160"},{"name":"from","type":"PublicKey"},{"name":"to","type":"PublicKey"},{"name":"amount","type":"Integer"}]}]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":["NEP-17"],"trusts":[],"extra":null},"updatecounter":0}`,
nativenames.Gas: `{"id":-6,"hash":"0xd2a4cff31913016155e38e474a2c06d08be276cf","nef":{"magic":860243278,"compiler":"neo-core-v3.0","source":"","tokens":[],"script":"EEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0A=","checksum":2663858513},"manifest":{"name":"GasToken","abi":{"methods":[{"name":"balanceOf","offset":0,"parameters":[{"name":"account","type":"Hash160"}],"returntype":"Integer","safe":true},{"name":"decimals","offset":7,"parameters":[],"returntype":"Integer","safe":true},{"name":"symbol","offset":14,"parameters":[],"returntype":"String","safe":true},{"name":"totalSupply","offset":21,"parameters":[],"returntype":"Integer","safe":true},{"name":"transfer","offset":28,"parameters":[{"name":"from","type":"Hash160"},{"name":"to","type":"Hash160"},{"name":"amount","type":"Integer"},{"name":"data","type":"Any"}],"returntype":"Boolean","safe":false}],"events":[{"name":"Transfer","parameters":[{"name":"from","type":"Hash160"},{"name":"to","type":"Hash160"},{"name":"amount","type":"Integer"}]}]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":["NEP-17"],"trusts":[],"extra":null},"updatecounter":0}`,
nativenames.Annos: `{"id":-5,"hash":"0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5","nef":{"magic":860243278,"compiler":"neo-core-v3.0","source":"","tokens":[],"script":"EEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQA==","checksum":65467259},"manifest":{"name":"NeoToken","abi":{"methods":[{"name":"balanceOf","offset":0,"parameters":[{"name":"account","type":"Hash160"}],"returntype":"Integer","safe":true},{"name":"decimals","offset":7,"parameters":[],"returntype":"Integer","safe":true},{"name":"getAccountState","offset":14,"parameters":[{"name":"account","type":"Hash160"}],"returntype":"Array","safe":true},{"name":"getAllCandidates","offset":21,"parameters":[],"returntype":"InteropInterface","safe":true},{"name":"getCandidateVote","offset":28,"parameters":[{"name":"pubKey","type":"PublicKey"}],"returntype":"Integer","safe":true},{"name":"getCandidates","offset":35,"parameters":[],"returntype":"Array","safe":true},{"name":"getCommittee","offset":42,"parameters":[],"returntype":"Array","safe":true},{"name":"getGasPerBlock","offset":49,"parameters":[],"returntype":"Integer","safe":true},{"name":"getNextBlockValidators","offset":56,"parameters":[],"returntype":"Array","safe":true},{"name":"getRegisterPrice","offset":63,"parameters":[],"returntype":"Integer","safe":true},{"name":"registerCandidate","offset":70,"parameters":[{"name":"pubkey","type":"PublicKey"}],"returntype":"Boolean","safe":false},{"name":"setGasPerBlock","offset":77,"parameters":[{"name":"gasPerBlock","type":"Integer"}],"returntype":"Void","safe":false},{"name":"setRegisterPrice","offset":84,"parameters":[{"name":"registerPrice","type":"Integer"}],"returntype":"Void","safe":false},{"name":"symbol","offset":91,"parameters":[],"returntype":"String","safe":true},{"name":"totalSupply","offset":98,"parameters":[],"returntype":"Integer","safe":true},{"name":"transfer","offset":105,"parameters":[{"name":"from","type":"Hash160"},{"name":"to","type":"Hash160"},{"name":"amount","type":"Integer"},{"name":"data","type":"Any"}],"returntype":"Boolean","safe":false},{"name":"unclaimedGas","offset":112,"parameters":[{"name":"account","type":"Hash160"},{"name":"end","type":"Integer"}],"returntype":"Integer","safe":true},{"name":"unregisterCandidate","offset":119,"parameters":[{"name":"pubkey","type":"PublicKey"}],"returntype":"Boolean","safe":false},{"name":"vote","offset":126,"parameters":[{"name":"account","type":"Hash160"},{"name":"voteTo","type":"PublicKey"}],"returntype":"Boolean","safe":false}],"events":[{"name":"Transfer","parameters":[{"name":"from","type":"Hash160"},{"name":"to","type":"Hash160"},{"name":"amount","type":"Integer"}]},{"name":"CandidateStateChanged","parameters":[{"name":"pubkey","type":"PublicKey"},{"name":"registered","type":"Boolean"},{"name":"votes","type":"Integer"}]},{"name":"Vote","parameters":[{"name":"account","type":"Hash160"},{"name":"from","type":"PublicKey"},{"name":"to","type":"PublicKey"},{"name":"amount","type":"Integer"}]}]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":["NEP-17"],"trusts":[],"extra":null},"updatecounter":0}`,
nativenames.Lub: `{"id":-6,"hash":"0xd2a4cff31913016155e38e474a2c06d08be276cf","nef":{"magic":860243278,"compiler":"neo-core-v3.0","source":"","tokens":[],"script":"EEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0A=","checksum":2663858513},"manifest":{"name":"GasToken","abi":{"methods":[{"name":"balanceOf","offset":0,"parameters":[{"name":"account","type":"Hash160"}],"returntype":"Integer","safe":true},{"name":"decimals","offset":7,"parameters":[],"returntype":"Integer","safe":true},{"name":"symbol","offset":14,"parameters":[],"returntype":"String","safe":true},{"name":"totalSupply","offset":21,"parameters":[],"returntype":"Integer","safe":true},{"name":"transfer","offset":28,"parameters":[{"name":"from","type":"Hash160"},{"name":"to","type":"Hash160"},{"name":"amount","type":"Integer"},{"name":"data","type":"Any"}],"returntype":"Boolean","safe":false}],"events":[{"name":"Transfer","parameters":[{"name":"from","type":"Hash160"},{"name":"to","type":"Hash160"},{"name":"amount","type":"Integer"}]}]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":["NEP-17"],"trusts":[],"extra":null},"updatecounter":0}`,
nativenames.Policy: `{"id":-7,"hash":"0xcc5e4edd9f5f8dba8bb65734541df7a1c081c67b","nef":{"magic":860243278,"compiler":"neo-core-v3.0","source":"","tokens":[],"script":"EEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0A=","checksum":1094259016},"manifest":{"name":"PolicyContract","abi":{"methods":[{"name":"blockAccount","offset":0,"parameters":[{"name":"account","type":"Hash160"}],"returntype":"Boolean","safe":false},{"name":"getAttributeFee","offset":7,"parameters":[{"name":"attributeType","type":"Integer"}],"returntype":"Integer","safe":true},{"name":"getExecFeeFactor","offset":14,"parameters":[],"returntype":"Integer","safe":true},{"name":"getFeePerByte","offset":21,"parameters":[],"returntype":"Integer","safe":true},{"name":"getStoragePrice","offset":28,"parameters":[],"returntype":"Integer","safe":true},{"name":"isBlocked","offset":35,"parameters":[{"name":"account","type":"Hash160"}],"returntype":"Boolean","safe":true},{"name":"setAttributeFee","offset":42,"parameters":[{"name":"attributeType","type":"Integer"},{"name":"value","type":"Integer"}],"returntype":"Void","safe":false},{"name":"setExecFeeFactor","offset":49,"parameters":[{"name":"value","type":"Integer"}],"returntype":"Void","safe":false},{"name":"setFeePerByte","offset":56,"parameters":[{"name":"value","type":"Integer"}],"returntype":"Void","safe":false},{"name":"setStoragePrice","offset":63,"parameters":[{"name":"value","type":"Integer"}],"returntype":"Void","safe":false},{"name":"unblockAccount","offset":70,"parameters":[{"name":"account","type":"Hash160"}],"returntype":"Boolean","safe":false}],"events":[]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":[],"trusts":[],"extra":null},"updatecounter":0}`,
nativenames.Designation: `{"id":-8,"hash":"0x49cf4e5378ffcd4dec034fd98a174c5491e395e2","nef":{"magic":860243278,"compiler":"neo-core-v3.0","source":"","tokens":[],"script":"EEEa93tnQBBBGvd7Z0A=","checksum":983638438},"manifest":{"name":"RoleManagement","abi":{"methods":[{"name":"designateAsRole","offset":0,"parameters":[{"name":"role","type":"Integer"},{"name":"nodes","type":"Array"}],"returntype":"Void","safe":false},{"name":"getDesignatedByRole","offset":7,"parameters":[{"name":"role","type":"Integer"},{"name":"index","type":"Integer"}],"returntype":"Array","safe":true}],"events":[{"name":"Designation","parameters":[{"name":"Role","type":"Integer"},{"name":"BlockIndex","type":"Integer"}]}]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":[],"trusts":[],"extra":null},"updatecounter":0}`,
nativenames.Oracle: `{"id":-9,"hash":"0xfe924b7cfe89ddd271abaf7210a80a7e11178758","nef":{"magic":860243278,"compiler":"neo-core-v3.0","source":"","tokens":[],"script":"EEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0A=","checksum":2663858513},"manifest":{"name":"OracleContract","abi":{"methods":[{"name":"finish","offset":0,"parameters":[],"returntype":"Void","safe":false},{"name":"getPrice","offset":7,"parameters":[],"returntype":"Integer","safe":true},{"name":"request","offset":14,"parameters":[{"name":"url","type":"String"},{"name":"filter","type":"String"},{"name":"callback","type":"String"},{"name":"userData","type":"Any"},{"name":"gasForResponse","type":"Integer"}],"returntype":"Void","safe":false},{"name":"setPrice","offset":21,"parameters":[{"name":"price","type":"Integer"}],"returntype":"Void","safe":false},{"name":"verify","offset":28,"parameters":[],"returntype":"Boolean","safe":true}],"events":[{"name":"OracleRequest","parameters":[{"name":"Id","type":"Integer"},{"name":"RequestContract","type":"Hash160"},{"name":"Url","type":"String"},{"name":"Filter","type":"String"}]},{"name":"OracleResponse","parameters":[{"name":"Id","type":"Integer"},{"name":"OriginalTx","type":"Hash256"}]}]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":[],"trusts":[],"extra":null},"updatecounter":0}`,
@ -69,7 +69,7 @@ var (
// under assumption that hardforks from Aspidochelone to Cockatrice (included) are enabled.
cockatriceCSS = map[string]string{
nativenames.CryptoLib: `{"id":-3,"hash":"0x726cb6e0cd8628a1350a611384688911ab75f51b","nef":{"magic":860243278,"compiler":"neo-core-v3.0","source":"","tokens":[],"script":"EEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0A=","checksum":1094259016},"manifest":{"name":"CryptoLib","abi":{"methods":[{"name":"bls12381Add","offset":0,"parameters":[{"name":"x","type":"InteropInterface"},{"name":"y","type":"InteropInterface"}],"returntype":"InteropInterface","safe":true},{"name":"bls12381Deserialize","offset":7,"parameters":[{"name":"data","type":"ByteArray"}],"returntype":"InteropInterface","safe":true},{"name":"bls12381Equal","offset":14,"parameters":[{"name":"x","type":"InteropInterface"},{"name":"y","type":"InteropInterface"}],"returntype":"Boolean","safe":true},{"name":"bls12381Mul","offset":21,"parameters":[{"name":"x","type":"InteropInterface"},{"name":"mul","type":"ByteArray"},{"name":"neg","type":"Boolean"}],"returntype":"InteropInterface","safe":true},{"name":"bls12381Pairing","offset":28,"parameters":[{"name":"g1","type":"InteropInterface"},{"name":"g2","type":"InteropInterface"}],"returntype":"InteropInterface","safe":true},{"name":"bls12381Serialize","offset":35,"parameters":[{"name":"g","type":"InteropInterface"}],"returntype":"ByteArray","safe":true},{"name":"keccak256","offset":42,"parameters":[{"name":"data","type":"ByteArray"}],"returntype":"ByteArray","safe":true},{"name":"murmur32","offset":49,"parameters":[{"name":"data","type":"ByteArray"},{"name":"seed","type":"Integer"}],"returntype":"ByteArray","safe":true},{"name":"ripemd160","offset":56,"parameters":[{"name":"data","type":"ByteArray"}],"returntype":"ByteArray","safe":true},{"name":"sha256","offset":63,"parameters":[{"name":"data","type":"ByteArray"}],"returntype":"ByteArray","safe":true},{"name":"verifyWithECDsa","offset":70,"parameters":[{"name":"message","type":"ByteArray"},{"name":"pubkey","type":"ByteArray"},{"name":"signature","type":"ByteArray"},{"name":"curveHash","type":"Integer"}],"returntype":"Boolean","safe":true}],"events":[]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":[],"trusts":[],"extra":null},"updatecounter":0}`,
nativenames.Neo: `{"id":-5,"hash":"0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5","nef":{"magic":860243278,"compiler":"neo-core-v3.0","source":"","tokens":[],"script":"EEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0A=","checksum":1325686241},"manifest":{"name":"NeoToken","abi":{"methods":[{"name":"balanceOf","offset":0,"parameters":[{"name":"account","type":"Hash160"}],"returntype":"Integer","safe":true},{"name":"decimals","offset":7,"parameters":[],"returntype":"Integer","safe":true},{"name":"getAccountState","offset":14,"parameters":[{"name":"account","type":"Hash160"}],"returntype":"Array","safe":true},{"name":"getAllCandidates","offset":21,"parameters":[],"returntype":"InteropInterface","safe":true},{"name":"getCandidateVote","offset":28,"parameters":[{"name":"pubKey","type":"PublicKey"}],"returntype":"Integer","safe":true},{"name":"getCandidates","offset":35,"parameters":[],"returntype":"Array","safe":true},{"name":"getCommittee","offset":42,"parameters":[],"returntype":"Array","safe":true},{"name":"getCommitteeAddress","offset":49,"parameters":[],"returntype":"Hash160","safe":true},{"name":"getGasPerBlock","offset":56,"parameters":[],"returntype":"Integer","safe":true},{"name":"getNextBlockValidators","offset":63,"parameters":[],"returntype":"Array","safe":true},{"name":"getRegisterPrice","offset":70,"parameters":[],"returntype":"Integer","safe":true},{"name":"registerCandidate","offset":77,"parameters":[{"name":"pubkey","type":"PublicKey"}],"returntype":"Boolean","safe":false},{"name":"setGasPerBlock","offset":84,"parameters":[{"name":"gasPerBlock","type":"Integer"}],"returntype":"Void","safe":false},{"name":"setRegisterPrice","offset":91,"parameters":[{"name":"registerPrice","type":"Integer"}],"returntype":"Void","safe":false},{"name":"symbol","offset":98,"parameters":[],"returntype":"String","safe":true},{"name":"totalSupply","offset":105,"parameters":[],"returntype":"Integer","safe":true},{"name":"transfer","offset":112,"parameters":[{"name":"from","type":"Hash160"},{"name":"to","type":"Hash160"},{"name":"amount","type":"Integer"},{"name":"data","type":"Any"}],"returntype":"Boolean","safe":false},{"name":"unclaimedGas","offset":119,"parameters":[{"name":"account","type":"Hash160"},{"name":"end","type":"Integer"}],"returntype":"Integer","safe":true},{"name":"unregisterCandidate","offset":126,"parameters":[{"name":"pubkey","type":"PublicKey"}],"returntype":"Boolean","safe":false},{"name":"vote","offset":133,"parameters":[{"name":"account","type":"Hash160"},{"name":"voteTo","type":"PublicKey"}],"returntype":"Boolean","safe":false}],"events":[{"name":"Transfer","parameters":[{"name":"from","type":"Hash160"},{"name":"to","type":"Hash160"},{"name":"amount","type":"Integer"}]},{"name":"CandidateStateChanged","parameters":[{"name":"pubkey","type":"PublicKey"},{"name":"registered","type":"Boolean"},{"name":"votes","type":"Integer"}]},{"name":"Vote","parameters":[{"name":"account","type":"Hash160"},{"name":"from","type":"PublicKey"},{"name":"to","type":"PublicKey"},{"name":"amount","type":"Integer"}]},{"name":"CommitteeChanged","parameters":[{"name":"old","type":"Array"},{"name":"new","type":"Array"}]}]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":["NEP-17"],"trusts":[],"extra":null},"updatecounter":0}`,
nativenames.Annos: `{"id":-5,"hash":"0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5","nef":{"magic":860243278,"compiler":"neo-core-v3.0","source":"","tokens":[],"script":"EEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0A=","checksum":1325686241},"manifest":{"name":"NeoToken","abi":{"methods":[{"name":"balanceOf","offset":0,"parameters":[{"name":"account","type":"Hash160"}],"returntype":"Integer","safe":true},{"name":"decimals","offset":7,"parameters":[],"returntype":"Integer","safe":true},{"name":"getAccountState","offset":14,"parameters":[{"name":"account","type":"Hash160"}],"returntype":"Array","safe":true},{"name":"getAllCandidates","offset":21,"parameters":[],"returntype":"InteropInterface","safe":true},{"name":"getCandidateVote","offset":28,"parameters":[{"name":"pubKey","type":"PublicKey"}],"returntype":"Integer","safe":true},{"name":"getCandidates","offset":35,"parameters":[],"returntype":"Array","safe":true},{"name":"getCommittee","offset":42,"parameters":[],"returntype":"Array","safe":true},{"name":"getCommitteeAddress","offset":49,"parameters":[],"returntype":"Hash160","safe":true},{"name":"getGasPerBlock","offset":56,"parameters":[],"returntype":"Integer","safe":true},{"name":"getNextBlockValidators","offset":63,"parameters":[],"returntype":"Array","safe":true},{"name":"getRegisterPrice","offset":70,"parameters":[],"returntype":"Integer","safe":true},{"name":"registerCandidate","offset":77,"parameters":[{"name":"pubkey","type":"PublicKey"}],"returntype":"Boolean","safe":false},{"name":"setGasPerBlock","offset":84,"parameters":[{"name":"gasPerBlock","type":"Integer"}],"returntype":"Void","safe":false},{"name":"setRegisterPrice","offset":91,"parameters":[{"name":"registerPrice","type":"Integer"}],"returntype":"Void","safe":false},{"name":"symbol","offset":98,"parameters":[],"returntype":"String","safe":true},{"name":"totalSupply","offset":105,"parameters":[],"returntype":"Integer","safe":true},{"name":"transfer","offset":112,"parameters":[{"name":"from","type":"Hash160"},{"name":"to","type":"Hash160"},{"name":"amount","type":"Integer"},{"name":"data","type":"Any"}],"returntype":"Boolean","safe":false},{"name":"unclaimedGas","offset":119,"parameters":[{"name":"account","type":"Hash160"},{"name":"end","type":"Integer"}],"returntype":"Integer","safe":true},{"name":"unregisterCandidate","offset":126,"parameters":[{"name":"pubkey","type":"PublicKey"}],"returntype":"Boolean","safe":false},{"name":"vote","offset":133,"parameters":[{"name":"account","type":"Hash160"},{"name":"voteTo","type":"PublicKey"}],"returntype":"Boolean","safe":false}],"events":[{"name":"Transfer","parameters":[{"name":"from","type":"Hash160"},{"name":"to","type":"Hash160"},{"name":"amount","type":"Integer"}]},{"name":"CandidateStateChanged","parameters":[{"name":"pubkey","type":"PublicKey"},{"name":"registered","type":"Boolean"},{"name":"votes","type":"Integer"}]},{"name":"Vote","parameters":[{"name":"account","type":"Hash160"},{"name":"from","type":"PublicKey"},{"name":"to","type":"PublicKey"},{"name":"amount","type":"Integer"}]},{"name":"CommitteeChanged","parameters":[{"name":"old","type":"Array"},{"name":"new","type":"Array"}]}]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":["NEP-17"],"trusts":[],"extra":null},"updatecounter":0}`,
}
// echidnaCSS holds serialized native contract states built for genesis block (with UpdateCounter 0)
// under assumption that hardforks from Aspidochelone to Echidna (included) are enabled.
@ -77,7 +77,7 @@ var (
nativenames.Management: `{"id":-1,"hash":"0xfffdc93764dbaddd97c48f252a53ea4643faa3fd","nef":{"magic":860243278,"compiler":"neo-core-v3.0","source":"","tokens":[],"script":"EEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dA","checksum":3581846399},"manifest":{"name":"ContractManagement","abi":{"methods":[{"name":"deploy","offset":0,"parameters":[{"name":"nefFile","type":"ByteArray"},{"name":"manifest","type":"ByteArray"}],"returntype":"Array","safe":false},{"name":"deploy","offset":7,"parameters":[{"name":"nefFile","type":"ByteArray"},{"name":"manifest","type":"ByteArray"},{"name":"data","type":"Any"}],"returntype":"Array","safe":false},{"name":"destroy","offset":14,"parameters":[],"returntype":"Void","safe":false},{"name":"getContract","offset":21,"parameters":[{"name":"hash","type":"Hash160"}],"returntype":"Array","safe":true},{"name":"getContractById","offset":28,"parameters":[{"name":"id","type":"Integer"}],"returntype":"Array","safe":true},{"name":"getContractHashes","offset":35,"parameters":[],"returntype":"InteropInterface","safe":true},{"name":"getMinimumDeploymentFee","offset":42,"parameters":[],"returntype":"Integer","safe":true},{"name":"hasMethod","offset":49,"parameters":[{"name":"hash","type":"Hash160"},{"name":"method","type":"String"},{"name":"pcount","type":"Integer"}],"returntype":"Boolean","safe":true},{"name":"isContract","offset":56,"parameters":[{"name":"hash","type":"Hash160"}],"returntype":"Boolean","safe":true},{"name":"setMinimumDeploymentFee","offset":63,"parameters":[{"name":"value","type":"Integer"}],"returntype":"Void","safe":false},{"name":"update","offset":70,"parameters":[{"name":"nefFile","type":"ByteArray"},{"name":"manifest","type":"ByteArray"}],"returntype":"Void","safe":false},{"name":"update","offset":77,"parameters":[{"name":"nefFile","type":"ByteArray"},{"name":"manifest","type":"ByteArray"},{"name":"data","type":"Any"}],"returntype":"Void","safe":false}],"events":[{"name":"Deploy","parameters":[{"name":"Hash","type":"Hash160"}]},{"name":"Update","parameters":[{"name":"Hash","type":"Hash160"}]},{"name":"Destroy","parameters":[{"name":"Hash","type":"Hash160"}]}]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":[],"trusts":[],"extra":null},"updatecounter":0}`,
nativenames.StdLib: `{"id":-2,"hash":"0xacce6fd80d44e1796aa0c2c625e9e4e0ce39efc0","nef":{"magic":860243278,"compiler":"neo-core-v3.0","source":"","tokens":[],"script":"EEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0A=","checksum":2681632925},"manifest":{"name":"StdLib","abi":{"methods":[{"name":"atoi","offset":0,"parameters":[{"name":"value","type":"String"}],"returntype":"Integer","safe":true},{"name":"atoi","offset":7,"parameters":[{"name":"value","type":"String"},{"name":"base","type":"Integer"}],"returntype":"Integer","safe":true},{"name":"base58CheckDecode","offset":14,"parameters":[{"name":"s","type":"String"}],"returntype":"ByteArray","safe":true},{"name":"base58CheckEncode","offset":21,"parameters":[{"name":"data","type":"ByteArray"}],"returntype":"String","safe":true},{"name":"base58Decode","offset":28,"parameters":[{"name":"s","type":"String"}],"returntype":"ByteArray","safe":true},{"name":"base58Encode","offset":35,"parameters":[{"name":"data","type":"ByteArray"}],"returntype":"String","safe":true},{"name":"base64Decode","offset":42,"parameters":[{"name":"s","type":"String"}],"returntype":"ByteArray","safe":true},{"name":"base64Encode","offset":49,"parameters":[{"name":"data","type":"ByteArray"}],"returntype":"String","safe":true},{"name":"base64UrlDecode","offset":56,"parameters":[{"name":"s","type":"String"}],"returntype":"String","safe":true},{"name":"base64UrlEncode","offset":63,"parameters":[{"name":"data","type":"String"}],"returntype":"String","safe":true},{"name":"deserialize","offset":70,"parameters":[{"name":"data","type":"ByteArray"}],"returntype":"Any","safe":true},{"name":"itoa","offset":77,"parameters":[{"name":"value","type":"Integer"}],"returntype":"String","safe":true},{"name":"itoa","offset":84,"parameters":[{"name":"value","type":"Integer"},{"name":"base","type":"Integer"}],"returntype":"String","safe":true},{"name":"jsonDeserialize","offset":91,"parameters":[{"name":"json","type":"ByteArray"}],"returntype":"Any","safe":true},{"name":"jsonSerialize","offset":98,"parameters":[{"name":"item","type":"Any"}],"returntype":"ByteArray","safe":true},{"name":"memoryCompare","offset":105,"parameters":[{"name":"str1","type":"ByteArray"},{"name":"str2","type":"ByteArray"}],"returntype":"Integer","safe":true},{"name":"memorySearch","offset":112,"parameters":[{"name":"mem","type":"ByteArray"},{"name":"value","type":"ByteArray"}],"returntype":"Integer","safe":true},{"name":"memorySearch","offset":119,"parameters":[{"name":"mem","type":"ByteArray"},{"name":"value","type":"ByteArray"},{"name":"start","type":"Integer"}],"returntype":"Integer","safe":true},{"name":"memorySearch","offset":126,"parameters":[{"name":"mem","type":"ByteArray"},{"name":"value","type":"ByteArray"},{"name":"start","type":"Integer"},{"name":"backward","type":"Boolean"}],"returntype":"Integer","safe":true},{"name":"serialize","offset":133,"parameters":[{"name":"item","type":"Any"}],"returntype":"ByteArray","safe":true},{"name":"strLen","offset":140,"parameters":[{"name":"str","type":"String"}],"returntype":"Integer","safe":true},{"name":"stringSplit","offset":147,"parameters":[{"name":"str","type":"String"},{"name":"separator","type":"String"}],"returntype":"Array","safe":true},{"name":"stringSplit","offset":154,"parameters":[{"name":"str","type":"String"},{"name":"separator","type":"String"},{"name":"removeEmptyEntries","type":"Boolean"}],"returntype":"Array","safe":true}],"events":[]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":[],"trusts":[],"extra":null},"updatecounter":0}`,
nativenames.CryptoLib: `{"id":-3,"hash":"0x726cb6e0cd8628a1350a611384688911ab75f51b","nef":{"magic":860243278,"compiler":"neo-core-v3.0","source":"","tokens":[],"script":"EEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQA==","checksum":174904780},"manifest":{"name":"CryptoLib","abi":{"methods":[{"name":"bls12381Add","offset":0,"parameters":[{"name":"x","type":"InteropInterface"},{"name":"y","type":"InteropInterface"}],"returntype":"InteropInterface","safe":true},{"name":"bls12381Deserialize","offset":7,"parameters":[{"name":"data","type":"ByteArray"}],"returntype":"InteropInterface","safe":true},{"name":"bls12381Equal","offset":14,"parameters":[{"name":"x","type":"InteropInterface"},{"name":"y","type":"InteropInterface"}],"returntype":"Boolean","safe":true},{"name":"bls12381Mul","offset":21,"parameters":[{"name":"x","type":"InteropInterface"},{"name":"mul","type":"ByteArray"},{"name":"neg","type":"Boolean"}],"returntype":"InteropInterface","safe":true},{"name":"bls12381Pairing","offset":28,"parameters":[{"name":"g1","type":"InteropInterface"},{"name":"g2","type":"InteropInterface"}],"returntype":"InteropInterface","safe":true},{"name":"bls12381Serialize","offset":35,"parameters":[{"name":"g","type":"InteropInterface"}],"returntype":"ByteArray","safe":true},{"name":"keccak256","offset":42,"parameters":[{"name":"data","type":"ByteArray"}],"returntype":"ByteArray","safe":true},{"name":"murmur32","offset":49,"parameters":[{"name":"data","type":"ByteArray"},{"name":"seed","type":"Integer"}],"returntype":"ByteArray","safe":true},{"name":"recoverSecp256K1","offset":56,"parameters":[{"name":"messageHash","type":"ByteArray"},{"name":"signature","type":"ByteArray"}],"returntype":"ByteArray","safe":true},{"name":"ripemd160","offset":63,"parameters":[{"name":"data","type":"ByteArray"}],"returntype":"ByteArray","safe":true},{"name":"sha256","offset":70,"parameters":[{"name":"data","type":"ByteArray"}],"returntype":"ByteArray","safe":true},{"name":"verifyWithECDsa","offset":77,"parameters":[{"name":"message","type":"ByteArray"},{"name":"pubkey","type":"ByteArray"},{"name":"signature","type":"ByteArray"},{"name":"curveHash","type":"Integer"}],"returntype":"Boolean","safe":true},{"name":"verifyWithEd25519","offset":84,"parameters":[{"name":"message","type":"ByteArray"},{"name":"pubkey","type":"ByteArray"},{"name":"signature","type":"ByteArray"}],"returntype":"Boolean","safe":true}],"events":[]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":[],"trusts":[],"extra":null},"updatecounter":0}`,
nativenames.Neo: `{"id":-5,"hash":"0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5","nef":{"magic":860243278,"compiler":"neo-core-v3.0","source":"","tokens":[],"script":"EEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dA","checksum":1991619121},"manifest":{"name":"NeoToken","abi":{"methods":[{"name":"balanceOf","offset":0,"parameters":[{"name":"account","type":"Hash160"}],"returntype":"Integer","safe":true},{"name":"decimals","offset":7,"parameters":[],"returntype":"Integer","safe":true},{"name":"getAccountState","offset":14,"parameters":[{"name":"account","type":"Hash160"}],"returntype":"Array","safe":true},{"name":"getAllCandidates","offset":21,"parameters":[],"returntype":"InteropInterface","safe":true},{"name":"getCandidateVote","offset":28,"parameters":[{"name":"pubKey","type":"PublicKey"}],"returntype":"Integer","safe":true},{"name":"getCandidates","offset":35,"parameters":[],"returntype":"Array","safe":true},{"name":"getCommittee","offset":42,"parameters":[],"returntype":"Array","safe":true},{"name":"getCommitteeAddress","offset":49,"parameters":[],"returntype":"Hash160","safe":true},{"name":"getGasPerBlock","offset":56,"parameters":[],"returntype":"Integer","safe":true},{"name":"getNextBlockValidators","offset":63,"parameters":[],"returntype":"Array","safe":true},{"name":"getRegisterPrice","offset":70,"parameters":[],"returntype":"Integer","safe":true},{"name":"onNEP17Payment","offset":77,"parameters":[{"name":"from","type":"Hash160"},{"name":"amount","type":"Integer"},{"name":"data","type":"Any"}],"returntype":"Void","safe":false},{"name":"registerCandidate","offset":84,"parameters":[{"name":"pubkey","type":"PublicKey"}],"returntype":"Boolean","safe":false},{"name":"setGasPerBlock","offset":91,"parameters":[{"name":"gasPerBlock","type":"Integer"}],"returntype":"Void","safe":false},{"name":"setRegisterPrice","offset":98,"parameters":[{"name":"registerPrice","type":"Integer"}],"returntype":"Void","safe":false},{"name":"symbol","offset":105,"parameters":[],"returntype":"String","safe":true},{"name":"totalSupply","offset":112,"parameters":[],"returntype":"Integer","safe":true},{"name":"transfer","offset":119,"parameters":[{"name":"from","type":"Hash160"},{"name":"to","type":"Hash160"},{"name":"amount","type":"Integer"},{"name":"data","type":"Any"}],"returntype":"Boolean","safe":false},{"name":"unclaimedGas","offset":126,"parameters":[{"name":"account","type":"Hash160"},{"name":"end","type":"Integer"}],"returntype":"Integer","safe":true},{"name":"unregisterCandidate","offset":133,"parameters":[{"name":"pubkey","type":"PublicKey"}],"returntype":"Boolean","safe":false},{"name":"vote","offset":140,"parameters":[{"name":"account","type":"Hash160"},{"name":"voteTo","type":"PublicKey"}],"returntype":"Boolean","safe":false}],"events":[{"name":"Transfer","parameters":[{"name":"from","type":"Hash160"},{"name":"to","type":"Hash160"},{"name":"amount","type":"Integer"}]},{"name":"CandidateStateChanged","parameters":[{"name":"pubkey","type":"PublicKey"},{"name":"registered","type":"Boolean"},{"name":"votes","type":"Integer"}]},{"name":"Vote","parameters":[{"name":"account","type":"Hash160"},{"name":"from","type":"PublicKey"},{"name":"to","type":"PublicKey"},{"name":"amount","type":"Integer"}]},{"name":"CommitteeChanged","parameters":[{"name":"old","type":"Array"},{"name":"new","type":"Array"}]}]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":["NEP-17","NEP-27"],"trusts":[],"extra":null},"updatecounter":0}`,
nativenames.Annos: `{"id":-5,"hash":"0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5","nef":{"magic":860243278,"compiler":"neo-core-v3.0","source":"","tokens":[],"script":"EEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dA","checksum":1991619121},"manifest":{"name":"NeoToken","abi":{"methods":[{"name":"balanceOf","offset":0,"parameters":[{"name":"account","type":"Hash160"}],"returntype":"Integer","safe":true},{"name":"decimals","offset":7,"parameters":[],"returntype":"Integer","safe":true},{"name":"getAccountState","offset":14,"parameters":[{"name":"account","type":"Hash160"}],"returntype":"Array","safe":true},{"name":"getAllCandidates","offset":21,"parameters":[],"returntype":"InteropInterface","safe":true},{"name":"getCandidateVote","offset":28,"parameters":[{"name":"pubKey","type":"PublicKey"}],"returntype":"Integer","safe":true},{"name":"getCandidates","offset":35,"parameters":[],"returntype":"Array","safe":true},{"name":"getCommittee","offset":42,"parameters":[],"returntype":"Array","safe":true},{"name":"getCommitteeAddress","offset":49,"parameters":[],"returntype":"Hash160","safe":true},{"name":"getGasPerBlock","offset":56,"parameters":[],"returntype":"Integer","safe":true},{"name":"getNextBlockValidators","offset":63,"parameters":[],"returntype":"Array","safe":true},{"name":"getRegisterPrice","offset":70,"parameters":[],"returntype":"Integer","safe":true},{"name":"onNEP17Payment","offset":77,"parameters":[{"name":"from","type":"Hash160"},{"name":"amount","type":"Integer"},{"name":"data","type":"Any"}],"returntype":"Void","safe":false},{"name":"registerCandidate","offset":84,"parameters":[{"name":"pubkey","type":"PublicKey"}],"returntype":"Boolean","safe":false},{"name":"setGasPerBlock","offset":91,"parameters":[{"name":"gasPerBlock","type":"Integer"}],"returntype":"Void","safe":false},{"name":"setRegisterPrice","offset":98,"parameters":[{"name":"registerPrice","type":"Integer"}],"returntype":"Void","safe":false},{"name":"symbol","offset":105,"parameters":[],"returntype":"String","safe":true},{"name":"totalSupply","offset":112,"parameters":[],"returntype":"Integer","safe":true},{"name":"transfer","offset":119,"parameters":[{"name":"from","type":"Hash160"},{"name":"to","type":"Hash160"},{"name":"amount","type":"Integer"},{"name":"data","type":"Any"}],"returntype":"Boolean","safe":false},{"name":"unclaimedGas","offset":126,"parameters":[{"name":"account","type":"Hash160"},{"name":"end","type":"Integer"}],"returntype":"Integer","safe":true},{"name":"unregisterCandidate","offset":133,"parameters":[{"name":"pubkey","type":"PublicKey"}],"returntype":"Boolean","safe":false},{"name":"vote","offset":140,"parameters":[{"name":"account","type":"Hash160"},{"name":"voteTo","type":"PublicKey"}],"returntype":"Boolean","safe":false}],"events":[{"name":"Transfer","parameters":[{"name":"from","type":"Hash160"},{"name":"to","type":"Hash160"},{"name":"amount","type":"Integer"}]},{"name":"CandidateStateChanged","parameters":[{"name":"pubkey","type":"PublicKey"},{"name":"registered","type":"Boolean"},{"name":"votes","type":"Integer"}]},{"name":"Vote","parameters":[{"name":"account","type":"Hash160"},{"name":"from","type":"PublicKey"},{"name":"to","type":"PublicKey"},{"name":"amount","type":"Integer"}]},{"name":"CommitteeChanged","parameters":[{"name":"old","type":"Array"},{"name":"new","type":"Array"}]}]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":["NEP-17","NEP-27"],"trusts":[],"extra":null},"updatecounter":0}`,
nativenames.Policy: `{"id":-7,"hash":"0xcc5e4edd9f5f8dba8bb65734541df7a1c081c67b","nef":{"magic":860243278,"compiler":"neo-core-v3.0","source":"","tokens":[],"script":"EEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0A=","checksum":588003825},"manifest":{"name":"PolicyContract","abi":{"methods":[{"name":"blockAccount","offset":0,"parameters":[{"name":"account","type":"Hash160"}],"returntype":"Boolean","safe":false},{"name":"getAttributeFee","offset":7,"parameters":[{"name":"attributeType","type":"Integer"}],"returntype":"Integer","safe":true},{"name":"getExecFeeFactor","offset":14,"parameters":[],"returntype":"Integer","safe":true},{"name":"getFeePerByte","offset":21,"parameters":[],"returntype":"Integer","safe":true},{"name":"getMaxTraceableBlocks","offset":28,"parameters":[],"returntype":"Integer","safe":true},{"name":"getMaxValidUntilBlockIncrement","offset":35,"parameters":[],"returntype":"Integer","safe":true},{"name":"getMillisecondsPerBlock","offset":42,"parameters":[],"returntype":"Integer","safe":true},{"name":"getStoragePrice","offset":49,"parameters":[],"returntype":"Integer","safe":true},{"name":"isBlocked","offset":56,"parameters":[{"name":"account","type":"Hash160"}],"returntype":"Boolean","safe":true},{"name":"setAttributeFee","offset":63,"parameters":[{"name":"attributeType","type":"Integer"},{"name":"value","type":"Integer"}],"returntype":"Void","safe":false},{"name":"setExecFeeFactor","offset":70,"parameters":[{"name":"value","type":"Integer"}],"returntype":"Void","safe":false},{"name":"setFeePerByte","offset":77,"parameters":[{"name":"value","type":"Integer"}],"returntype":"Void","safe":false},{"name":"setMaxTraceableBlocks","offset":84,"parameters":[{"name":"value","type":"Integer"}],"returntype":"Void","safe":false},{"name":"setMaxValidUntilBlockIncrement","offset":91,"parameters":[{"name":"value","type":"Integer"}],"returntype":"Void","safe":false},{"name":"setMillisecondsPerBlock","offset":98,"parameters":[{"name":"value","type":"Integer"}],"returntype":"Void","safe":false},{"name":"setStoragePrice","offset":105,"parameters":[{"name":"value","type":"Integer"}],"returntype":"Void","safe":false},{"name":"unblockAccount","offset":112,"parameters":[{"name":"account","type":"Hash160"}],"returntype":"Boolean","safe":false}],"events":[{"name":"MillisecondsPerBlockChanged","parameters":[{"name":"old","type":"Integer"},{"name":"new","type":"Integer"}]}]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":[],"trusts":[],"extra":null},"updatecounter":0}`,
nativenames.Designation: `{"id":-8,"hash":"0x49cf4e5378ffcd4dec034fd98a174c5491e395e2","nef":{"magic":860243278,"compiler":"neo-core-v3.0","source":"","tokens":[],"script":"EEEa93tnQBBBGvd7Z0A=","checksum":983638438},"manifest":{"name":"RoleManagement","abi":{"methods":[{"name":"designateAsRole","offset":0,"parameters":[{"name":"role","type":"Integer"},{"name":"nodes","type":"Array"}],"returntype":"Void","safe":false},{"name":"getDesignatedByRole","offset":7,"parameters":[{"name":"role","type":"Integer"},{"name":"index","type":"Integer"}],"returntype":"Array","safe":true}],"events":[{"name":"Designation","parameters":[{"name":"Role","type":"Integer"},{"name":"BlockIndex","type":"Integer"},{"name":"Old","type":"Array"},{"name":"New","type":"Array"}]}]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":[],"trusts":[],"extra":null},"updatecounter":0}`,
nativenames.Notary: `{"id":-10,"hash":"0xc1e14f19c3e60d0b9244d06dd7ba9b113135ec3b","nef":{"magic":860243278,"compiler":"neo-core-v3.0","source":"","tokens":[],"script":"EEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0AQQRr3e2dAEEEa93tnQBBBGvd7Z0A=","checksum":1110259869},"manifest":{"name":"Notary","abi":{"methods":[{"name":"balanceOf","offset":0,"parameters":[{"name":"account","type":"Hash160"}],"returntype":"Integer","safe":true},{"name":"expirationOf","offset":7,"parameters":[{"name":"account","type":"Hash160"}],"returntype":"Integer","safe":true},{"name":"getMaxNotValidBeforeDelta","offset":14,"parameters":[],"returntype":"Integer","safe":true},{"name":"lockDepositUntil","offset":21,"parameters":[{"name":"account","type":"Hash160"},{"name":"till","type":"Integer"}],"returntype":"Boolean","safe":false},{"name":"onNEP17Payment","offset":28,"parameters":[{"name":"from","type":"Hash160"},{"name":"amount","type":"Integer"},{"name":"data","type":"Any"}],"returntype":"Void","safe":false},{"name":"setMaxNotValidBeforeDelta","offset":35,"parameters":[{"name":"value","type":"Integer"}],"returntype":"Void","safe":false},{"name":"verify","offset":42,"parameters":[{"name":"signature","type":"ByteArray"}],"returntype":"Boolean","safe":true},{"name":"withdraw","offset":49,"parameters":[{"name":"from","type":"Hash160"},{"name":"to","type":"Hash160"}],"returntype":"Boolean","safe":false}],"events":[]},"features":{},"groups":[],"permissions":[{"contract":"*","methods":"*"}],"supportedstandards":["NEP-27"],"trusts":[],"extra":null},"updatecounter":0}`,
@ -265,9 +265,9 @@ func TestManagement_NativeDeployUpdateNotifications(t *testing.T) {
// Notary and Treasury are not deployed at genesis
// Federation activates at HFFaun, not genesis
continue
case nativenames.Gas:
case nativenames.Lub:
expected = append(expected, state.NotificationEvent{
ScriptHash: nativehashes.GasToken,
ScriptHash: nativehashes.LubToken,
Name: "Transfer",
Item: stackitem.NewArray([]stackitem.Item{
stackitem.Null{},
@ -275,14 +275,14 @@ func TestManagement_NativeDeployUpdateNotifications(t *testing.T) {
stackitem.Make(mgmt.Chain.GetConfig().InitialGASSupply),
}),
})
case nativenames.Neo:
case nativenames.Annos:
expected = append(expected, state.NotificationEvent{
ScriptHash: nativehashes.NeoToken,
ScriptHash: nativehashes.AnnosToken,
Name: "Transfer",
Item: stackitem.NewArray([]stackitem.Item{
stackitem.Null{},
stackitem.Make(mgmt.Validator.ScriptHash()),
stackitem.Make(native.NEOTotalSupply),
stackitem.Make(native.AnnosTotalSupply),
}),
})
}
@ -301,7 +301,7 @@ func TestManagement_NativeDeployUpdateNotifications(t *testing.T) {
require.NoError(t, err)
require.Equal(t, 1, len(aer))
expected = expected[:0]
for _, name := range []string{nativenames.CryptoLib, nativenames.Neo} {
for _, name := range []string{nativenames.CryptoLib, nativenames.Annos} {
expected = append(expected, state.NotificationEvent{
ScriptHash: nativehashes.ContractManagement,
Name: "Update",
@ -324,7 +324,7 @@ func TestManagement_NativeDeployUpdateNotifications(t *testing.T) {
require.NoError(t, err)
require.Equal(t, 1, len(aer))
expected = expected[:0]
for _, h := range []util.Uint160{nativehashes.ContractManagement, nativehashes.StdLib, nativehashes.CryptoLib, nativehashes.NeoToken, nativehashes.PolicyContract, nativehashes.RoleManagement} {
for _, h := range []util.Uint160{nativehashes.ContractManagement, nativehashes.StdLib, nativehashes.CryptoLib, nativehashes.AnnosToken, nativehashes.PolicyContract, nativehashes.RoleManagement} {
expected = append(expected, state.NotificationEvent{
ScriptHash: nativehashes.ContractManagement,
Name: "Update",
@ -416,7 +416,7 @@ func TestManagement_NativeUpdate(t *testing.T) {
require.NotNil(t, cs, name)
}
var actual = cs
if name == nativenames.Neo || name == nativenames.CryptoLib {
if name == nativenames.Annos || name == nativenames.CryptoLib {
// A tiny hack to reuse cockatriceCSS map in the check below.
require.Equal(t, uint16(1), cs.UpdateCounter, name)
cp := *cs
@ -473,7 +473,7 @@ func TestManagement_NativeUpdate_Call(t *testing.T) {
cockatriceHeight = 3
method = "getCommitteeAddress"
)
c := newCustomNativeClient(t, nativenames.Neo, func(cfg *config.Blockchain) {
c := newCustomNativeClient(t, nativenames.Annos, func(cfg *config.Blockchain) {
cfg.Hardforks = map[string]uint32{
config.HFAspidochelone.String(): 0,
config.HFBasilisk.String(): 0,
@ -625,8 +625,8 @@ func TestManagement_ContractCache(t *testing.T) {
nativehashes.StdLib,
nativehashes.CryptoLib,
nativehashes.LedgerContract,
nativehashes.NeoToken,
nativehashes.GasToken,
nativehashes.AnnosToken,
nativehashes.LubToken,
nativehashes.PolicyContract,
nativehashes.RoleManagement,
nativehashes.OracleContract,

View File

@ -48,23 +48,23 @@ func newNeoCommitteeClient(t *testing.T, expectedGASBalance int) *neotest.Contra
e := neotest.NewExecutor(t, bc, validators, committee)
if expectedGASBalance > 0 {
e.ValidatorInvoker(e.NativeHash(t, nativenames.Gas)).Invoke(t, true, "transfer", e.Validator.ScriptHash(), e.CommitteeHash, expectedGASBalance, nil)
e.ValidatorInvoker(e.NativeHash(t, nativenames.Lub)).Invoke(t, true, "transfer", e.Validator.ScriptHash(), e.CommitteeHash, expectedGASBalance, nil)
}
return e.CommitteeInvoker(e.NativeHash(t, nativenames.Neo))
return e.CommitteeInvoker(e.NativeHash(t, nativenames.Annos))
}
func newNeoValidatorsClient(t *testing.T) *neotest.ContractInvoker {
c := newNeoCommitteeClient(t, 100_0000_0000)
return c.ValidatorInvoker(c.NativeHash(t, nativenames.Neo))
return c.ValidatorInvoker(c.NativeHash(t, nativenames.Annos))
}
func TestNEO_GasPerBlock(t *testing.T) {
testGetSet(t, newNeoCommitteeClient(t, 100_0000_0000), "GasPerBlock", 5*native.GASFactor, 0, 10*native.GASFactor)
testGetSet(t, newNeoCommitteeClient(t, 100_0000_0000), "GasPerBlock", 5*native.LubFactor, 0, 10*native.LubFactor)
}
func TestNEO_GasPerBlockCache(t *testing.T) {
testGetSetCache(t, newNeoCommitteeClient(t, 100_0000_0000), "GasPerBlock", 5*native.GASFactor)
testGetSetCache(t, newNeoCommitteeClient(t, 100_0000_0000), "GasPerBlock", 5*native.LubFactor)
}
func TestNEO_RegisterPrice(t *testing.T) {
@ -76,7 +76,7 @@ func TestNEO_RegisterPriceCache(t *testing.T) {
}
func TestNEO_CandidateEvents(t *testing.T) {
c := newNativeClient(t, nativenames.Neo)
c := newNativeClient(t, nativenames.Annos)
singleSigner := c.Signers[0].(neotest.MultiSigner).Single(0)
cc := c.WithSigners(c.Signers[0], singleSigner)
e := c.Executor
@ -383,7 +383,7 @@ func TestNEO_RecursiveGASMint(t *testing.T) {
neoCommitteeInvoker := newNeoCommitteeClient(t, 100_0000_0000)
neoValidatorInvoker := neoCommitteeInvoker.WithSigners(neoCommitteeInvoker.Validator)
e := neoCommitteeInvoker.Executor
gasValidatorInvoker := e.ValidatorInvoker(e.NativeHash(t, nativenames.Gas))
gasValidatorInvoker := e.ValidatorInvoker(e.NativeHash(t, nativenames.Lub))
c := neotest.CompileFile(t, e.Validator.ScriptHash(), "../../../../internal/basicchain/testdata/test_contract.go", "../../../../internal/basicchain/testdata/test_contract.yml")
e.DeployContract(t, c, nil)
@ -490,8 +490,8 @@ func TestNEO_GetAccountState(t *testing.T) {
advanceChain(t)
neoValidatorInvoker.WithSigners(acc).Invoke(t, true, "transfer", acc.ScriptHash(), acc.ScriptHash(), amount, nil)
as = getAccountState(t, acc.ScriptHash())
expect := GasPerBlock * native.GASFactor * VoterRewardRatio / 100 * (uint64(e.Chain.BlockHeight()) / uint64(committeeSize))
expect = expect * uint64(committeeSize) / uint64(validatorSize+committeeSize) * native.NEOTotalSupply / as.Balance.Uint64()
expect := GasPerBlock * native.LubFactor * VoterRewardRatio / 100 * (uint64(e.Chain.BlockHeight()) / uint64(committeeSize))
expect = expect * uint64(committeeSize) / uint64(validatorSize+committeeSize) * native.AnnosTotalSupply / as.Balance.Uint64()
require.Equal(t, e.Chain.BlockHeight(), as.BalanceHeight)
require.Equal(t, expect, as.LastGasPerVote.Uint64())
})
@ -547,8 +547,8 @@ func TestNEO_GetAccountStateInteropAPI(t *testing.T) {
GasPerBlock = 5
VoterRewardRatio = 80
)
expect := GasPerBlock * native.GASFactor * VoterRewardRatio / 100 * (uint64(e.Chain.BlockHeight()) / uint64(committeeSize))
expect = expect * uint64(committeeSize) / uint64(validatorSize+committeeSize) * native.NEOTotalSupply / uint64(amount)
expect := GasPerBlock * native.LubFactor * VoterRewardRatio / 100 * (uint64(e.Chain.BlockHeight()) / uint64(committeeSize))
expect = expect * uint64(committeeSize) / uint64(validatorSize+committeeSize) * native.AnnosTotalSupply / uint64(amount)
ctrInvoker := e.NewInvoker(ctr.Hash, e.Committee)
ctrInvoker.Invoke(t, stackitem.Make(expect), "getLastGasPerVote")
}
@ -613,7 +613,7 @@ func TestNEO_TransferOnPayment(t *testing.T) {
ScriptHash: cs.Hash,
Name: "LastPaymentNEP17",
Item: stackitem.NewArray([]stackitem.Item{
stackitem.NewByteArray(e.NativeHash(t, nativenames.Neo).BytesBE()),
stackitem.NewByteArray(e.NativeHash(t, nativenames.Annos).BytesBE()),
stackitem.NewByteArray(e.Validator.ScriptHash().BytesBE()),
stackitem.NewBigInteger(big.NewInt(amount)),
stackitem.Null{},
@ -623,7 +623,7 @@ func TestNEO_TransferOnPayment(t *testing.T) {
ScriptHash: cs.Hash,
Name: "LastPaymentNEP17",
Item: stackitem.NewArray([]stackitem.Item{
stackitem.NewByteArray(e.NativeHash(t, nativenames.Gas).BytesBE()),
stackitem.NewByteArray(e.NativeHash(t, nativenames.Lub).BytesBE()),
stackitem.Null{},
stackitem.NewBigInteger(big.NewInt(1)),
stackitem.Null{},
@ -781,7 +781,7 @@ func TestNEO_CalculateBonus(t *testing.T) {
for range rewardDistance/2 - 2 {
e.AddNewBlock(t)
}
neoCommitteeInvoker.Invoke(t, stackitem.Null{}, "setGasPerBlock", newGASPerBlock*native.GASFactor)
neoCommitteeInvoker.Invoke(t, stackitem.Null{}, "setGasPerBlock", newGASPerBlock*native.LubFactor)
// Five blocks more with modified GasPerBlock value.
for range rewardDistance / 2 {
@ -921,7 +921,7 @@ func TestNEO_RegisterViaNEP27(t *testing.T) {
neoCommitteeInvoker := newNeoCommitteeClient(t, 100_0000_0000)
neoValidatorsInvoker := neoCommitteeInvoker.WithSigners(neoCommitteeInvoker.Validator)
e := neoCommitteeInvoker.Executor
neoHash := e.NativeHash(t, nativenames.Neo)
neoHash := e.NativeHash(t, nativenames.Annos)
cfg := e.Chain.GetConfig()
candidatesCount := cfg.GetCommitteeSize(0) - 1
@ -944,7 +944,7 @@ func TestNEO_RegisterViaNEP27(t *testing.T) {
e.AddNewBlock(t)
}
gasValidatorsInvoker := e.CommitteeInvoker(e.NativeHash(t, nativenames.Gas))
gasValidatorsInvoker := e.CommitteeInvoker(e.NativeHash(t, nativenames.Lub))
txes := make([]*transaction.Transaction, 0, candidatesCount*3)
for i := range candidatesCount {
transferTx := neoValidatorsInvoker.PrepareInvoke(t, "transfer", e.Validator.ScriptHash(), voters[i].(neotest.SingleSigner).Account().PrivateKey().GetScriptHash(), int64(candidatesCount+1-i)*1000000, nil)

View File

@ -51,8 +51,8 @@ func TestNotary_MaxNotValidBeforeDeltaCache(t *testing.T) {
func TestNotary_Pipeline(t *testing.T) {
notaryCommitteeInvoker := newNotaryClient(t)
e := notaryCommitteeInvoker.Executor
neoCommitteeInvoker := e.CommitteeInvoker(e.NativeHash(t, nativenames.Neo))
gasCommitteeInvoker := e.CommitteeInvoker(e.NativeHash(t, nativenames.Gas))
annosCommitteeInvoker := e.CommitteeInvoker(e.NativeHash(t, nativenames.Annos))
lubCommitteeInvoker := e.CommitteeInvoker(e.NativeHash(t, nativenames.Lub))
notaryHash := notaryCommitteeInvoker.NativeHash(t, nativenames.Notary)
feePerKey := e.Chain.GetNotaryServiceFeePerKey()
@ -76,19 +76,19 @@ func TestNotary_Pipeline(t *testing.T) {
notaryCommitteeInvoker.Invoke(t, false, "lockDepositUntil", multisigHash, int64(depositLock+1))
// `onPayment`: bad token
neoCommitteeInvoker.InvokeFail(t, "only GAS can be accepted for deposit", "transfer", multisigHash, notaryHash, int64(1), &notary.OnNEP17PaymentData{Till: uint32(depositLock)})
annosCommitteeInvoker.InvokeFail(t, "only GAS can be accepted for deposit", "transfer", multisigHash, notaryHash, int64(1), &notary.OnNEP17PaymentData{Till: uint32(depositLock)})
// `onPayment`: insufficient first deposit
gasCommitteeInvoker.InvokeFail(t, "first deposit can not be less than", "transfer", multisigHash, notaryHash, int64(2*feePerKey-1), &notary.OnNEP17PaymentData{Till: uint32(depositLock)})
lubCommitteeInvoker.InvokeFail(t, "first deposit can not be less than", "transfer", multisigHash, notaryHash, int64(2*feePerKey-1), &notary.OnNEP17PaymentData{Till: uint32(depositLock)})
// `onPayment`: invalid `data` (missing `till` parameter)
gasCommitteeInvoker.InvokeFail(t, "`data` parameter should be an array of 2 elements", "transfer", multisigHash, notaryHash, 2*feePerKey, []any{nil})
lubCommitteeInvoker.InvokeFail(t, "`data` parameter should be an array of 2 elements", "transfer", multisigHash, notaryHash, 2*feePerKey, []any{nil})
// `onPayment`: invalid `data` (outdated `till` parameter)
gasCommitteeInvoker.InvokeFail(t, "`till` shouldn't be less than the chain's height", "transfer", multisigHash, notaryHash, 2*feePerKey, &notary.OnNEP17PaymentData{})
lubCommitteeInvoker.InvokeFail(t, "`till` shouldn't be less than the chain's height", "transfer", multisigHash, notaryHash, 2*feePerKey, &notary.OnNEP17PaymentData{})
// `onPayment`: good
gasCommitteeInvoker.Invoke(t, true, "transfer", multisigHash, notaryHash, 2*feePerKey, &notary.OnNEP17PaymentData{Till: uint32(depositLock)})
lubCommitteeInvoker.Invoke(t, true, "transfer", multisigHash, notaryHash, 2*feePerKey, &notary.OnNEP17PaymentData{Till: uint32(depositLock)})
checkBalanceOf(t, notaryHash, 2*feePerKey)
// `expirationOf`: check `till` was set
@ -98,7 +98,7 @@ func TestNotary_Pipeline(t *testing.T) {
notaryCommitteeInvoker.Invoke(t, 2*feePerKey, "balanceOf", multisigHash)
// `onPayment`: good second deposit and explicit `to` paramenter
gasCommitteeInvoker.Invoke(t, true, "transfer", multisigHash, notaryHash, feePerKey, &notary.OnNEP17PaymentData{Account: &multisigHash, Till: uint32(depositLock + 1)})
lubCommitteeInvoker.Invoke(t, true, "transfer", multisigHash, notaryHash, feePerKey, &notary.OnNEP17PaymentData{Account: &multisigHash, Till: uint32(depositLock + 1)})
checkBalanceOf(t, notaryHash, 3*feePerKey)
// `balanceOf`: check deposited amount for the multisig account
@ -108,17 +108,17 @@ func TestNotary_Pipeline(t *testing.T) {
notaryCommitteeInvoker.Invoke(t, depositLock+1, "expirationOf", multisigHash)
// `onPayment`: empty payment, should fail because `till` less than the previous one
gasCommitteeInvoker.InvokeFail(t, "`till` shouldn't be less than the previous value", "transfer", multisigHash, notaryHash, int64(0), &notary.OnNEP17PaymentData{Account: &multisigHash, Till: uint32(depositLock)})
lubCommitteeInvoker.InvokeFail(t, "`till` shouldn't be less than the previous value", "transfer", multisigHash, notaryHash, int64(0), &notary.OnNEP17PaymentData{Account: &multisigHash, Till: uint32(depositLock)})
checkBalanceOf(t, notaryHash, 3*feePerKey)
notaryCommitteeInvoker.Invoke(t, depositLock+1, "expirationOf", multisigHash)
// `onPayment`: empty payment, should fail because `till` less than the chain height
gasCommitteeInvoker.InvokeFail(t, "`till` shouldn't be less than the chain's height", "transfer", multisigHash, notaryHash, int64(0), &notary.OnNEP17PaymentData{Account: &multisigHash, Till: uint32(1)})
lubCommitteeInvoker.InvokeFail(t, "`till` shouldn't be less than the chain's height", "transfer", multisigHash, notaryHash, int64(0), &notary.OnNEP17PaymentData{Account: &multisigHash, Till: uint32(1)})
checkBalanceOf(t, notaryHash, 3*feePerKey)
notaryCommitteeInvoker.Invoke(t, depositLock+1, "expirationOf", multisigHash)
// `onPayment`: empty payment, should successfully update `till`
gasCommitteeInvoker.Invoke(t, true, "transfer", multisigHash, notaryHash, int64(0), &notary.OnNEP17PaymentData{Account: &multisigHash, Till: uint32(depositLock + 2)})
lubCommitteeInvoker.Invoke(t, true, "transfer", multisigHash, notaryHash, int64(0), &notary.OnNEP17PaymentData{Account: &multisigHash, Till: uint32(depositLock + 2)})
checkBalanceOf(t, notaryHash, 3*feePerKey)
notaryCommitteeInvoker.Invoke(t, depositLock+2, "expirationOf", multisigHash)
@ -160,12 +160,12 @@ func TestNotary_Pipeline(t *testing.T) {
notaryCommitteeInvoker.Invoke(t, false, "withdraw", multisigHash, accHash)
// `onPayment`: good first deposit to other account, should set default `till` even if other `till` value is provided
gasCommitteeInvoker.Invoke(t, true, "transfer", multisigHash, notaryHash, 2*feePerKey, &notary.OnNEP17PaymentData{Account: &accHash, Till: uint32(math.MaxUint32 - 1)})
lubCommitteeInvoker.Invoke(t, true, "transfer", multisigHash, notaryHash, 2*feePerKey, &notary.OnNEP17PaymentData{Account: &accHash, Till: uint32(math.MaxUint32 - 1)})
checkBalanceOf(t, notaryHash, 2*feePerKey)
notaryCommitteeInvoker.Invoke(t, 5760+e.Chain.BlockHeight()-1, "expirationOf", accHash)
// `onPayment`: good second deposit to other account, shouldn't update `till` even if other `till` value is provided
gasCommitteeInvoker.Invoke(t, true, "transfer", multisigHash, notaryHash, feePerKey, &notary.OnNEP17PaymentData{Account: &accHash, Till: uint32(math.MaxUint32 - 1)})
lubCommitteeInvoker.Invoke(t, true, "transfer", multisigHash, notaryHash, feePerKey, &notary.OnNEP17PaymentData{Account: &accHash, Till: uint32(math.MaxUint32 - 1)})
checkBalanceOf(t, notaryHash, 3*feePerKey)
notaryCommitteeInvoker.Invoke(t, 5760+e.Chain.BlockHeight()-3, "expirationOf", accHash)
}
@ -174,7 +174,7 @@ func TestNotary_MaliciousWithdrawal(t *testing.T) {
const defaultDepositDeltaTill = 5760
notaryCommitteeInvoker := newNotaryClient(t)
e := notaryCommitteeInvoker.Executor
gasCommitteeInvoker := e.CommitteeInvoker(e.NativeHash(t, nativenames.Gas))
lubCommitteeInvoker := e.CommitteeInvoker(e.NativeHash(t, nativenames.Lub))
notaryHash := notaryCommitteeInvoker.NativeHash(t, nativenames.Notary)
feePerKey := e.Chain.GetNotaryServiceFeePerKey()
@ -191,7 +191,7 @@ func TestNotary_MaliciousWithdrawal(t *testing.T) {
count := 3
for range count {
h := random.Uint160()
gasCommitteeInvoker.Invoke(t, true, "transfer", multisigHash, notaryHash, 2*feePerKey, &notary.OnNEP17PaymentData{Account: &h, Till: e.Chain.BlockHeight() + 2})
lubCommitteeInvoker.Invoke(t, true, "transfer", multisigHash, notaryHash, 2*feePerKey, &notary.OnNEP17PaymentData{Account: &h, Till: e.Chain.BlockHeight() + 2})
}
checkBalanceOf(t, notaryHash, int64(count)*2*feePerKey)
@ -226,7 +226,7 @@ func TestNotary_MaliciousWithdrawal(t *testing.T) {
Methods: manifest.WildStrings{},
}}})
e.DeployContract(t, ctr, nil)
gasCommitteeInvoker.Invoke(t, true, "transfer", multisigHash, notaryHash, 2*feePerKey, &notary.OnNEP17PaymentData{Account: &ctr.Hash, Till: e.Chain.BlockHeight() + 2})
lubCommitteeInvoker.Invoke(t, true, "transfer", multisigHash, notaryHash, 2*feePerKey, &notary.OnNEP17PaymentData{Account: &ctr.Hash, Till: e.Chain.BlockHeight() + 2})
checkBalanceOf(t, notaryHash, int64(count+1)*2*feePerKey)
depositLock := e.Chain.BlockHeight() + defaultDepositDeltaTill
@ -241,14 +241,14 @@ func TestNotary_MaliciousWithdrawal(t *testing.T) {
}))
maliciousInvoker.Invoke(t, true, "withdraw", ctr.Hash, ctr.Hash)
checkBalanceOf(t, notaryHash, int64(count)*2*feePerKey)
gasCommitteeInvoker.CheckGASBalance(t, ctr.Hash, big.NewInt(2*feePerKey))
lubCommitteeInvoker.CheckGASBalance(t, ctr.Hash, big.NewInt(2*feePerKey))
}
func TestNotary_NotaryNodesReward(t *testing.T) {
checkReward := func(nKeys int, nNotaryNodes int, spendFullDeposit bool) {
notaryCommitteeInvoker := newNotaryClient(t)
e := notaryCommitteeInvoker.Executor
gasCommitteeInvoker := e.CommitteeInvoker(e.NativeHash(t, nativenames.Gas))
lubCommitteeInvoker := e.CommitteeInvoker(e.NativeHash(t, nativenames.Lub))
designationCommitteeInvoker := e.CommitteeInvoker(e.NativeHash(t, nativenames.Designation))
notaryHash := notaryCommitteeInvoker.NativeHash(t, nativenames.Notary)
@ -276,7 +276,7 @@ func TestNotary_NotaryNodesReward(t *testing.T) {
if !spendFullDeposit {
depositAmount += 1_0000
}
gasCommitteeInvoker.Invoke(t, true, "transfer", multisigHash, notaryHash, depositAmount, &notary.OnNEP17PaymentData{Account: &multisigHash, Till: e.Chain.BlockHeight() + 2})
lubCommitteeInvoker.Invoke(t, true, "transfer", multisigHash, notaryHash, depositAmount, &notary.OnNEP17PaymentData{Account: &multisigHash, Till: e.Chain.BlockHeight() + 2})
// send transaction with Notary contract as a sender
tx := transaction.New([]byte{byte(opcode.PUSH1)}, 1_000_000)

View File

@ -52,7 +52,7 @@ func TestOracle_Request(t *testing.T) {
e := oracleCommitteeInvoker.Executor
managementCommitteeInvoker := e.CommitteeInvoker(e.NativeHash(t, nativenames.Management))
designationCommitteeInvoker := e.CommitteeInvoker(e.NativeHash(t, nativenames.Designation))
gasCommitteeInvoker := e.CommitteeInvoker(e.NativeHash(t, nativenames.Gas))
lubCommitteeInvoker := e.CommitteeInvoker(e.NativeHash(t, nativenames.Lub))
cs := contracts.GetOracleContractState(t, pathToInternalContracts, e.Validator.ScriptHash(), 1)
nBytes, err := cs.NEF.Bytes()
@ -75,7 +75,7 @@ func TestOracle_Request(t *testing.T) {
err = oracleNode.(neotest.SingleSigner).Account().ConvertMultisig(1, []*keys.PublicKey{oracleNode.(neotest.SingleSigner).Account().PublicKey()})
require.NoError(t, err)
oracleNodeMulti := neotest.NewMultiSigner(oracleNode.(neotest.SingleSigner).Account())
gasCommitteeInvoker.Invoke(t, true, "transfer", gasCommitteeInvoker.CommitteeHash, oracleNodeMulti.ScriptHash(), 100_0000_0000, nil)
lubCommitteeInvoker.Invoke(t, true, "transfer", lubCommitteeInvoker.CommitteeHash, oracleNodeMulti.ScriptHash(), 100_0000_0000, nil)
// Finish.
prepareResponseTx := func(t *testing.T, requestID uint64) *transaction.Transaction {

View File

@ -359,7 +359,7 @@ func TestPolicy_BlockedAccounts(t *testing.T) {
})
t.Run("block-unblock contract", func(t *testing.T) {
committeeInvoker.InvokeFail(t, "cannot block native contract", "blockAccount", c.NativeHash(t, nativenames.Neo))
committeeInvoker.InvokeFail(t, "cannot block native contract", "blockAccount", c.NativeHash(t, nativenames.Annos))
helper := neotest.CompileFile(t, c.CommitteeHash, "./helpers/policyhelper", "./helpers/policyhelper/policyhelper.yml")
e.DeployContract(t, helper, nil)
@ -379,22 +379,22 @@ func TestPolicy_BlockedAccounts(t *testing.T) {
pub := candidate.(neotest.SingleSigner).Account().PublicKey()
// Transfer some NEO to the account.
tx := e.NewTx(t, []neotest.Signer{e.Validator}, e.NativeHash(t, nativenames.Neo), "transfer", e.Validator.ScriptHash(), acc.ScriptHash(), 1_000, nil)
tx := e.NewTx(t, []neotest.Signer{e.Validator}, e.NativeHash(t, nativenames.Annos), "transfer", e.Validator.ScriptHash(), acc.ScriptHash(), 1_000, nil)
e.AddNewBlock(t, tx)
e.CheckHalt(t, tx.Hash())
// Register a candidate and vote.
g := c.NewInvoker(nativehashes.GasToken, acc, candidate)
n := c.NewInvoker(nativehashes.NeoToken, acc)
nCommittee := c.NewInvoker(nativehashes.NeoToken, e.Committee)
g.Invoke(t, true, "transfer", acc.ScriptHash(), nativehashes.NeoToken, 1000*native.GASFactor, pub.Bytes())
g := c.NewInvoker(nativehashes.LubToken, acc, candidate)
n := c.NewInvoker(nativehashes.AnnosToken, acc)
nCommittee := c.NewInvoker(nativehashes.AnnosToken, e.Committee)
g.Invoke(t, true, "transfer", acc.ScriptHash(), nativehashes.AnnosToken, 1000*native.LubFactor, pub.Bytes())
n.Invoke(t, true, "vote", acc.ScriptHash(), pub.Bytes())
n.Invoke(t, 1_000, "getCandidateVote", pub.Bytes())
// Block the account and check notification and revoked votes.
h := committeeInvoker.Invoke(t, true, "blockAccount", acc.ScriptHash())
e.CheckTxNotificationEvent(t, h, 0, state.NotificationEvent{
ScriptHash: nativehashes.NeoToken,
ScriptHash: nativehashes.AnnosToken,
Name: "Vote",
Item: stackitem.NewArray([]stackitem.Item{
stackitem.Make(acc.ScriptHash()),

View File

@ -56,7 +56,7 @@ func TestTreasury_Verify(t *testing.T) {
}
func TestTreasury_OnNEP17Payment(t *testing.T) {
g := newCustomNativeClient(t, nativenames.Gas, func(cfg *config.Blockchain) {
g := newCustomNativeClient(t, nativenames.Lub, func(cfg *config.Blockchain) {
cfg.Hardforks = map[string]uint32{
config.HFFaun.String(): 0,
}

View File

@ -17,10 +17,10 @@ var (
CryptoLib = util.Uint160{0x1b, 0xf5, 0x75, 0xab, 0x11, 0x89, 0x68, 0x84, 0x13, 0x61, 0xa, 0x35, 0xa1, 0x28, 0x86, 0xcd, 0xe0, 0xb6, 0x6c, 0x72}
// LedgerContract is a hash of native LedgerContract contract.
LedgerContract = util.Uint160{0xbe, 0xf2, 0x4, 0x31, 0x40, 0x36, 0x2a, 0x77, 0xc1, 0x50, 0x99, 0xc7, 0xe6, 0x4c, 0x12, 0xf7, 0x0, 0xb6, 0x65, 0xda}
// NeoToken is a hash of native NeoToken contract.
NeoToken = util.Uint160{0xf5, 0x63, 0xea, 0x40, 0xbc, 0x28, 0x3d, 0x4d, 0xe, 0x5, 0xc4, 0x8e, 0xa3, 0x5, 0xb3, 0xf2, 0xa0, 0x73, 0x40, 0xef}
// GasToken is a hash of native GasToken contract.
GasToken = util.Uint160{0xcf, 0x76, 0xe2, 0x8b, 0xd0, 0x6, 0x2c, 0x4a, 0x47, 0x8e, 0xe3, 0x55, 0x61, 0x1, 0x13, 0x19, 0xf3, 0xcf, 0xa4, 0xd2}
// AnnosToken is a hash of native AnnosToken contract.
AnnosToken = util.Uint160{0xf0, 0xf8, 0x1, 0x65, 0x48, 0x2c, 0x87, 0x9e, 0x15, 0xb0, 0x49, 0x5, 0xf1, 0x3f, 0xe8, 0x75, 0x46, 0x3e, 0x9b, 0x24}
// LubToken is a hash of native LubToken contract.
LubToken = util.Uint160{0x69, 0xe8, 0x15, 0x86, 0x5e, 0xaa, 0x14, 0x6f, 0xdd, 0x64, 0x79, 0xd4, 0xa3, 0x57, 0xf0, 0x70, 0x93, 0xbb, 0x95, 0xe8}
// PolicyContract is a hash of native PolicyContract contract.
PolicyContract = util.Uint160{0x7b, 0xc6, 0x81, 0xc0, 0xa1, 0xf7, 0x1d, 0x54, 0x34, 0x57, 0xb6, 0x8b, 0xba, 0x8d, 0x5f, 0x9f, 0xdd, 0x4e, 0x5e, 0xcc}
// RoleManagement is a hash of native RoleManagement contract.

View File

@ -15,10 +15,10 @@ const (
CryptoLib int32 = -3
// LedgerContract is an ID of native LedgerContract contract.
LedgerContract int32 = -4
// NeoToken is an ID of native NeoToken contract.
NeoToken int32 = -5
// GasToken is an ID of native GasToken contract.
GasToken int32 = -6
// Annos is an ID of native AnnosToken contract.
Annos int32 = -5
// Lub is an ID of native LubToken contract.
Lub int32 = -6
// PolicyContract is an ID of native PolicyContract contract.
PolicyContract int32 = -7
// RoleManagement is an ID of native RoleManagement contract.

View File

@ -4,8 +4,8 @@ package nativenames
const (
Management = "ContractManagement"
Ledger = "LedgerContract"
Neo = "NeoToken"
Gas = "GasToken"
Annos = "AnnosToken"
Lub = "LubToken"
Policy = "PolicyContract"
Oracle = "OracleContract"
Designation = "RoleManagement"
@ -35,8 +35,8 @@ var All = []string{
StdLib,
CryptoLib,
Ledger,
Neo,
Gas,
Annos,
Lub,
Policy,
Designation,
Oracle,
@ -62,8 +62,8 @@ var All = []string{
func IsValid(name string) bool {
return name == Management ||
name == Ledger ||
name == Neo ||
name == Gas ||
name == Annos ||
name == Lub ||
name == Policy ||
name == Oracle ||
name == Designation ||

View File

@ -30,8 +30,8 @@ import (
// Notary represents Notary native contract.
type Notary struct {
interop.ContractMD
GAS IGAS
NEO INEO
Lub ILub
Annos IAnnos
Desig IDesignate
Policy IPolicy
}
@ -199,7 +199,7 @@ func (n *Notary) OnPersist(ic *interop.Context) error {
feePerKey := n.Policy.GetAttributeFeeInternal(ic.DAO, transaction.NotaryAssistedT)
singleReward := calculateNotaryReward(nFees, feePerKey, len(notaries))
for _, notary := range notaries {
n.GAS.Mint(ic, notary.GetScriptHash(), singleReward, false)
n.Lub.Mint(ic, notary.GetScriptHash(), singleReward, false)
}
return nil
}
@ -217,8 +217,8 @@ func (n *Notary) ActiveIn() *config.Hardfork {
// onPayment records the deposited amount as belonging to "from" address with a lock
// till the specified chain's height.
func (n *Notary) onPayment(ic *interop.Context, args []stackitem.Item) stackitem.Item {
if h := ic.VM.GetCallingScriptHash(); h != n.GAS.Metadata().Hash {
panic(fmt.Errorf("only GAS can be accepted for deposit, got %s", h.StringBE()))
if h := ic.VM.GetCallingScriptHash(); h != n.Lub.Metadata().Hash {
panic(fmt.Errorf("only Lub can be accepted for deposit, got %s", h.StringBE()))
}
from := toUint160(args[0])
to := from
@ -316,9 +316,9 @@ func (n *Notary) withdraw(ic *interop.Context, args []stackitem.Item) stackitem.
if ic.BlockHeight() < deposit.Till {
return stackitem.NewBool(false)
}
cs, err := ic.GetContract(n.GAS.Metadata().Hash)
cs, err := ic.GetContract(n.Lub.Metadata().Hash)
if err != nil {
panic(fmt.Errorf("failed to get GAS contract state: %w", err))
panic(fmt.Errorf("failed to get Lub contract state: %w", err))
}
// Remove deposit before GAS transfer processing to avoid double-withdrawal.
@ -434,7 +434,7 @@ func (n *Notary) setMaxNotValidBeforeDelta(ic *interop.Context, args []stackitem
if value > maxInc/2 || value < uint32(cfg.GetNumOfCNs(ic.BlockHeight())) {
panic(fmt.Errorf("MaxNotValidBeforeDelta cannot be more than %d or less than %d", maxInc/2, cfg.GetNumOfCNs(ic.BlockHeight())))
}
if !n.NEO.CheckCommittee(ic) {
if !n.Annos.CheckCommittee(ic) {
panic("invalid committee signature")
}
setIntWithKey(n.ID, ic.DAO, maxNotValidBeforeDeltaKey, int64(value))

View File

@ -22,7 +22,7 @@ import (
// Opus represents the AI workforce integration native contract.
type Opus struct {
interop.ContractMD
NEO INEO
Annos IAnnos
Vita IVita
VTS IVTS
RoleRegistry IRoleRegistry
@ -129,7 +129,7 @@ func (o *Opus) checkCommittee(ic *interop.Context) bool {
if o.RoleRegistry != nil {
return o.RoleRegistry.CheckCommittee(ic)
}
return o.NEO.CheckCommittee(ic)
return o.Annos.CheckCommittee(ic)
}
// checkOpusSupervisor checks if the caller has opus supervisor authority.

View File

@ -33,8 +33,8 @@ import (
// Oracle represents Oracle native contract.
type Oracle struct {
interop.ContractMD
GAS IGAS
NEO INEO
Lub ILub
Annos IAnnos
Desig IDesignate
oracleScript []byte
@ -231,7 +231,7 @@ func (o *Oracle) PostPersist(ic *interop.Context) error {
}
}
for i := range reward {
o.GAS.Mint(ic, nodes[i].GetScriptHash(), &reward[i], false)
o.Lub.Mint(ic, nodes[i].GetScriptHash(), &reward[i], false)
}
if len(removedIDs) != 0 {
@ -402,7 +402,7 @@ func (o *Oracle) RequestInternal(ic *interop.Context, url string, filter *string
return ErrNotEnoughGas
}
callingHash := ic.VM.GetCallingScriptHash()
o.GAS.Mint(ic, o.Hash, gas, false)
o.Lub.Mint(ic, o.Hash, gas, false)
si := ic.DAO.GetStorageItem(o.ID, prefixRequestID)
itemID := bigint.FromBytes(si)
id := itemID.Uint64()
@ -518,7 +518,7 @@ func (o *Oracle) setPrice(ic *interop.Context, args []stackitem.Item) stackitem.
if price.Sign() <= 0 || !price.IsInt64() {
panic("invalid register price")
}
if !o.NEO.CheckCommittee(ic) {
if !o.Annos.CheckCommittee(ic) {
panic("invalid committee signature")
}
setIntWithKey(o.ID, ic.DAO, prefixRequestPrice, price.Int64())

View File

@ -25,7 +25,7 @@ import (
// transaction flows with judicial declassification.
type Palam struct {
interop.ContractMD
NEO INEO
Annos IAnnos
Vita IVita
RoleRegistry IRoleRegistry
Lex ILex

View File

@ -80,7 +80,7 @@ var (
// Policy represents Policy native contract.
type Policy struct {
interop.ContractMD
NEO INEO
Annos IAnnos
}
type PolicyCache struct {
@ -503,7 +503,7 @@ func (p *Policy) setExecFeeFactor(ic *interop.Context, args []stackitem.Item) st
if value <= 0 || maxValue < value {
panic(fmt.Errorf("ExecFeeFactor must be between 1 and %d", maxExecFeeFactor))
}
if !p.NEO.CheckCommittee(ic) {
if !p.Annos.CheckCommittee(ic) {
panic("invalid committee signature")
}
setIntWithKey(p.ID, ic.DAO, execFeeFactorKey, int64(value))
@ -555,7 +555,7 @@ func (p *Policy) setStoragePrice(ic *interop.Context, args []stackitem.Item) sta
if value <= 0 || maxStoragePrice < value {
panic(fmt.Errorf("StoragePrice must be between 1 and %d", maxStoragePrice))
}
if !p.NEO.CheckCommittee(ic) {
if !p.Annos.CheckCommittee(ic) {
panic("invalid committee signature")
}
setIntWithKey(p.ID, ic.DAO, storagePriceKey, int64(value))
@ -616,7 +616,7 @@ func (p *Policy) setAttributeFeeGeneric(ic *interop.Context, args []stackitem.It
if value > maxAttributeFee {
panic(fmt.Errorf("attribute value is out of range: %d", value))
}
if !p.NEO.CheckCommittee(ic) {
if !p.Annos.CheckCommittee(ic) {
panic("invalid committee signature")
}
setIntWithKey(p.ID, ic.DAO, []byte{attributeFeePrefix, byte(t)}, int64(value))
@ -631,7 +631,7 @@ func (p *Policy) setFeePerByte(ic *interop.Context, args []stackitem.Item) stack
if value < 0 || value > maxFeePerByte {
panic(fmt.Errorf("FeePerByte shouldn't be negative or greater than %d", maxFeePerByte))
}
if !p.NEO.CheckCommittee(ic) {
if !p.Annos.CheckCommittee(ic) {
panic("invalid committee signature")
}
setIntWithKey(p.ID, ic.DAO, feePerByteKey, value)
@ -643,7 +643,7 @@ func (p *Policy) setFeePerByte(ic *interop.Context, args []stackitem.Item) stack
// blockAccount is a Policy contract method that adds the given account hash to the list
// of blocked accounts.
func (p *Policy) blockAccount(ic *interop.Context, args []stackitem.Item) stackitem.Item {
if !p.NEO.CheckCommittee(ic) {
if !p.Annos.CheckCommittee(ic) {
panic("invalid committee signature")
}
hash := toUint160(args[0])
@ -660,7 +660,7 @@ func (p *Policy) BlockAccountInternal(ic *interop.Context, hash util.Uint160) bo
if blocked {
return false
}
var _ = p.NEO.RevokeVotes(ic, hash) // ignore error, as in the reference.
var _ = p.Annos.RevokeVotes(ic, hash) // ignore error, as in the reference.
key := append([]byte{blockedAccountPrefix}, hash.BytesBE()...)
ic.DAO.PutStorageItem(p.ID, key, state.StorageItem{})
cache := ic.DAO.GetRWCache(p.ID).(*PolicyCache)
@ -676,7 +676,7 @@ func (p *Policy) BlockAccountInternal(ic *interop.Context, hash util.Uint160) bo
// unblockAccount is a Policy contract method that removes the given account hash from
// the list of blocked accounts.
func (p *Policy) unblockAccount(ic *interop.Context, args []stackitem.Item) stackitem.Item {
if !p.NEO.CheckCommittee(ic) {
if !p.Annos.CheckCommittee(ic) {
panic("invalid committee signature")
}
hash := toUint160(args[0])
@ -721,7 +721,7 @@ func (p *Policy) setMaxValidUntilBlockIncrement(ic *interop.Context, args []stac
if value >= mtb {
panic(fmt.Errorf("MaxValidUntilBlockIncrement should be less than MaxTraceableBlocks %d, got %d", mtb, value))
}
if !p.NEO.CheckCommittee(ic) {
if !p.Annos.CheckCommittee(ic) {
panic("invalid committee signature")
}
setIntWithKey(p.ID, ic.DAO, maxVUBIncrementKey, int64(value))
@ -746,7 +746,7 @@ func (p *Policy) setMillisecondsPerBlock(ic *interop.Context, args []stackitem.I
if value <= 0 || maxMillisecondsPerBlock < value {
panic(fmt.Errorf("MillisecondsPerBlock should be positive and not greater than %d, got %d", maxMillisecondsPerBlock, value))
}
if !p.NEO.CheckCommittee(ic) {
if !p.Annos.CheckCommittee(ic) {
panic("invalid committee signature")
}
setIntWithKey(p.ID, ic.DAO, msPerBlockKey, int64(value))
@ -788,7 +788,7 @@ func (p *Policy) setMaxTraceableBlocks(ic *interop.Context, args []stackitem.Ite
if value <= maxVUBInc {
panic(fmt.Errorf("MaxTraceableBlocks should be larger than MaxValidUntilBlockIncrement %d, got %d", maxVUBInc, value))
}
if !p.NEO.CheckCommittee(ic) {
if !p.Annos.CheckCommittee(ic) {
panic("invalid committee signature")
}
@ -862,7 +862,7 @@ func (p *Policy) CleanWhitelist(ic *interop.Context, cs *state.Contract) error {
}
func (p *Policy) removeWhitelistFeeContract(ic *interop.Context, args []stackitem.Item) stackitem.Item {
if !p.NEO.CheckCommittee(ic) {
if !p.Annos.CheckCommittee(ic) {
panic("invalid committee signature")
}
h := toUint160(args[0])
@ -911,7 +911,7 @@ func (p *Policy) setWhitelistFeeContract(ic *interop.Context, args []stackitem.I
if fee < 0 {
panic(fmt.Errorf("fee should be positive, got %d", fee))
}
if !p.NEO.CheckCommittee(ic) {
if !p.Annos.CheckCommittee(ic) {
panic("invalid committee signature")
}

View File

@ -26,7 +26,7 @@ import (
// - Education and healthcare credential portability
type Pons struct {
interop.ContractMD
NEO INEO
Annos IAnnos
Vita IVita
Federation *Federation
RoleRegistry *RoleRegistry
@ -739,7 +739,7 @@ func (p *Pons) getConfig(ic *interop.Context, _ []stackitem.Item) stackitem.Item
func (p *Pons) setLocalChainID(ic *interop.Context, args []stackitem.Item) stackitem.Item {
chainID := uint32(toBigInt(args[0]).Int64())
if !p.NEO.CheckCommittee(ic) {
if !p.Annos.CheckCommittee(ic) {
panic("only committee can set chain ID")
}
@ -763,7 +763,7 @@ func (p *Pons) createAgreement(ic *interop.Context, args []stackitem.Item) stack
}
expirationHeight := uint32(toBigInt(args[3]).Int64())
if !p.NEO.CheckCommittee(ic) {
if !p.Annos.CheckCommittee(ic) {
panic("only committee can create agreements")
}
@ -802,7 +802,7 @@ func (p *Pons) updateAgreementStatus(ic *interop.Context, args []stackitem.Item)
agreementID := toBigInt(args[0]).Uint64()
newStatus := state.AgreementStatus(toBigInt(args[1]).Int64())
if !p.NEO.CheckCommittee(ic) {
if !p.Annos.CheckCommittee(ic) {
panic("only committee can update agreement status")
}
@ -930,7 +930,7 @@ func (p *Pons) respondVerification(ic *interop.Context, args []stackitem.Item) s
panic(err)
}
if !p.NEO.CheckCommittee(ic) {
if !p.Annos.CheckCommittee(ic) {
panic("only committee can respond to verification requests")
}
@ -1041,7 +1041,7 @@ func (p *Pons) completeSettlement(ic *interop.Context, args []stackitem.Item) st
panic(err)
}
if !p.NEO.CheckCommittee(ic) {
if !p.Annos.CheckCommittee(ic) {
panic("only committee can complete settlements")
}
@ -1081,7 +1081,7 @@ func (p *Pons) cancelSettlement(ic *interop.Context, args []stackitem.Item) stac
// Allow sender or committee to cancel
caller := ic.VM.GetCallingScriptHash()
if !caller.Equals(sr.Sender) && !p.NEO.CheckCommittee(ic) {
if !caller.Equals(sr.Sender) && !p.Annos.CheckCommittee(ic) {
panic("only sender or committee can cancel settlement")
}
@ -1183,7 +1183,7 @@ func (p *Pons) revokeCredentialShare(ic *interop.Context, args []stackitem.Item)
// Allow owner or committee to revoke
caller := ic.VM.GetCallingScriptHash()
if !caller.Equals(cs.Owner) && !p.NEO.CheckCommittee(ic) {
if !caller.Equals(cs.Owner) && !p.Annos.CheckCommittee(ic) {
panic(ErrNotCredentialOwner)
}

View File

@ -26,8 +26,8 @@ import (
type RoleRegistry struct {
interop.ContractMD
// NEO is used for fallback committee checks when TutusCommittee is not set.
NEO INEO
// Annos is used for fallback committee checks when TutusCommittee is not set.
Annos IAnnos
// tutusCommittee contains initial committee member addresses from config.
tutusCommittee []util.Uint160
@ -357,9 +357,9 @@ func (r *RoleRegistry) CheckCommittee(ic *interop.Context) bool {
}
}
// Fallback to NEO.CheckCommittee for backwards compatibility
// Fallback to Annos.CheckCommittee for backwards compatibility
// This allows StandbyCommittee to work when TutusCommittee is not configured
if r.NEO != nil && r.NEO.CheckCommittee(ic) {
if r.Annos != nil && r.Annos.CheckCommittee(ic) {
return true
}
@ -382,9 +382,9 @@ func (r *RoleRegistry) checkCommitteeWitness(ic *interop.Context) error {
return nil
}
}
// Fallback to NEO.CheckCommittee for backwards compatibility
// Fallback to Annos.CheckCommittee for backwards compatibility
// This allows StandbyCommittee to work when TutusCommittee is not configured
if r.NEO != nil && r.NEO.CheckCommittee(ic) {
if r.Annos != nil && r.Annos.CheckCommittee(ic) {
return nil
}
return ErrRoleRegistryNotCommittee

View File

@ -21,7 +21,7 @@ import (
// Salus represents the universal healthcare native contract.
type Salus struct {
interop.ContractMD
NEO INEO
Annos IAnnos
Vita IVita
RoleRegistry IRoleRegistry
Lex ILex
@ -129,7 +129,7 @@ func (s *Salus) checkCommittee(ic *interop.Context) bool {
if s.RoleRegistry != nil {
return s.RoleRegistry.CheckCommittee(ic)
}
return s.NEO.CheckCommittee(ic)
return s.Annos.CheckCommittee(ic)
}
// checkHealthcareProvider checks if the caller has healthcare provider authority.

View File

@ -22,7 +22,7 @@ import (
// Scire represents the universal education native contract.
type Scire struct {
interop.ContractMD
NEO INEO
Annos IAnnos
Vita IVita
RoleRegistry IRoleRegistry
Lex ILex
@ -118,7 +118,7 @@ func (s *Scire) checkCommittee(ic *interop.Context) bool {
if s.RoleRegistry != nil {
return s.RoleRegistry.CheckCommittee(ic)
}
return s.NEO.CheckCommittee(ic)
return s.Annos.CheckCommittee(ic)
}
// checkEducator checks if the caller has educator authority.

View File

@ -21,7 +21,7 @@ import (
// Sese represents the life planning native contract.
type Sese struct {
interop.ContractMD
NEO INEO
Annos IAnnos
Vita IVita
RoleRegistry IRoleRegistry
Lex ILex
@ -134,7 +134,7 @@ func (s *Sese) checkCommittee(ic *interop.Context) bool {
if s.RoleRegistry != nil {
return s.RoleRegistry.CheckCommittee(ic)
}
return s.NEO.CheckCommittee(ic)
return s.Annos.CheckCommittee(ic)
}
// checkLifePlanner checks if the caller has life planner authority.

View File

@ -18,7 +18,7 @@ import (
// Treasury represents Treasury native contract.
type Treasury struct {
interop.ContractMD
NEO INEO
Annos IAnnos
}
// Storage key prefixes for Treasury.
@ -90,7 +90,7 @@ func (t *Treasury) ActiveIn() *config.Hardfork {
}
func (t *Treasury) verify(ic *interop.Context, _ []stackitem.Item) stackitem.Item {
return stackitem.NewBool(t.NEO.CheckCommittee(ic))
return stackitem.NewBool(t.Annos.CheckCommittee(ic))
}
func (t *Treasury) onNEP11Payment(ic *interop.Context, args []stackitem.Item) stackitem.Item {

View File

@ -22,7 +22,7 @@ import (
// Tribute represents the anti-hoarding economics native contract.
type Tribute struct {
interop.ContractMD
NEO INEO
Annos IAnnos
Vita IVita
VTS IVTS
RoleRegistry IRoleRegistry
@ -120,7 +120,7 @@ func (t *Tribute) checkCommittee(ic *interop.Context) bool {
if t.RoleRegistry != nil {
return t.RoleRegistry.CheckCommittee(ic)
}
return t.NEO.CheckCommittee(ic)
return t.Annos.CheckCommittee(ic)
}
// checkTributeAdmin checks if the caller has tribute admin authority.

View File

@ -25,7 +25,7 @@ import (
// Vita represents a soul-bound identity native contract.
type Vita struct {
interop.ContractMD
NEO INEO
Annos IAnnos
RoleRegistry IRoleRegistry
Lex ILex
}
@ -137,8 +137,8 @@ func (v *Vita) checkCommittee(ic *interop.Context) bool {
if v.RoleRegistry != nil {
return v.RoleRegistry.CheckCommittee(ic)
}
// Fallback to NEO for backwards compatibility
return v.NEO.CheckCommittee(ic)
// Fallback to Annos for backwards compatibility
return v.Annos.CheckCommittee(ic)
}
// newVita creates a new Vita native contract.

View File

@ -39,7 +39,7 @@ const VTSFactor = 100000000
type VTS struct {
interop.ContractMD
NEO INEO
Annos IAnnos
RoleRegistry IRoleRegistry
Vita IVita
Lex ILex
@ -397,8 +397,8 @@ func (v *VTS) checkCommittee(ic *interop.Context) bool {
if v.RoleRegistry != nil {
return v.RoleRegistry.CheckCommittee(ic)
}
if v.NEO != nil {
return v.NEO.CheckCommittee(ic)
if v.Annos != nil {
return v.Annos.CheckCommittee(ic)
}
return false
}

View File

@ -129,7 +129,7 @@ func (e *Executor) NewAccount(t testing.TB, expectedGASBalance ...int64) Signer
amount = expectedGASBalance[0]
}
tx := e.NewTx(t, []Signer{e.Validator},
e.NativeHash(t, nativenames.Gas), "transfer",
e.NativeHash(t, nativenames.Lub), "transfer",
e.Validator.ScriptHash(), acc.Contract.ScriptHash(), amount, nil)
e.AddNewBlock(t, tx)
e.CheckHalt(t, tx.Hash())

View File

@ -13,7 +13,7 @@ import (
)
// Hash stores the hash of the native GAS contract.
var Hash = nativehashes.GasToken
var Hash = nativehashes.LubToken
// NewReader creates a NEP-17 reader for the GAS contract.
func NewReader(invoker nep17.Invoker) *nep17.TokenReader {

View File

@ -97,7 +97,7 @@ type ValidatorIterator struct {
}
// Hash stores the hash of the native NEOToken contract.
var Hash = nativehashes.NeoToken
var Hash = nativehashes.AnnosToken
// NewReader creates an instance of ContractReader to get data from the NEO
// contract.