Complete Annos to Tutus rename across codebase

Update all remaining references from Annos (old governance contract name)
to Tutus (blockchain governance contract) across the codebase:

Contract Updates:
- All native contracts: .Annos field → .Tutus field
- Interface references: IAnnos → ITutus
- Method calls: annos.* → tutus.*

Files Updated:
- blockchain.go: annos field → tutus field
- All native contracts (collocatio, designate, federation, lex,
  management, native_lub, notary, opus, oracle, palam, policy,
  pons, role_registry, salus, scire, sese, treasury, tribute, vts)
- native_tutus.go: Internal struct/method renames

Test Updates:
- Updated all test files to use new Tutus references
- Fixed expected manifest names: NeoToken → TutusToken, GasToken → LubToken
- Updated Vita register calls with birthTimestamp parameter
- Fixed expected error messages (GAS → Lub)

CLI/RPC Updates:
- cli/wallet: Updated native contract references
- rpcclient/neo: Updated for Tutus naming

This completes Phase 1 of the refactoring:
- Tutus = blockchain governance (validators, committee, staking)
- Annos = lifespan/years tracking (age, life stages, entitlements)

🤖 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-21 00:56:43 +00:00
parent a18363ce0b
commit a2bf6a95df
38 changed files with 264 additions and 243 deletions

View File

@ -272,7 +272,7 @@ func getNEPBalance(ctx *cli.Context, standard string, accHandler func(*cli.Conte
var h util.Uint160 var h util.Uint160
// Well-known hardcoded names/symbols. // Well-known hardcoded names/symbols.
if standard == manifest.NEP17StandardName && (name == nativenames.Annos || name == "NEO") { if standard == manifest.NEP17StandardName && (name == nativenames.Tutus || name == "NEO") {
h = neo.Hash h = neo.Hash
} else if standard == manifest.NEP17StandardName && (name == nativenames.Lub || name == "GAS") { } else if standard == manifest.NEP17StandardName && (name == nativenames.Lub || name == "GAS") {
h = gas.Hash h = gas.Hash

View File

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

View File

@ -93,7 +93,7 @@ func Init(t *testing.T, rootpath string, e *neotest.Executor) {
) )
gasHash := e.NativeHash(t, nativenames.Lub) gasHash := e.NativeHash(t, nativenames.Lub)
neoHash := e.NativeHash(t, nativenames.Annos) neoHash := e.NativeHash(t, nativenames.Tutus)
policyHash := e.NativeHash(t, nativenames.Policy) policyHash := e.NativeHash(t, nativenames.Policy)
notaryHash := e.NativeHash(t, nativenames.Notary) notaryHash := e.NativeHash(t, nativenames.Notary)
designationHash := e.NativeHash(t, nativenames.Designation) designationHash := e.NativeHash(t, nativenames.Designation)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -45,7 +45,7 @@ func (n annos) RevokeVotes(ic *interop.Context, h util.Uint160) error { retur
func TestDeployGetUpdateDestroyContract(t *testing.T) { func TestDeployGetUpdateDestroyContract(t *testing.T) {
mgmt := NewManagement() mgmt := NewManagement()
p := newPolicy() p := newPolicy()
p.Annos = annos{} p.Tutus = annos{}
mgmt.Policy = p mgmt.Policy = p
d := dao.NewSimple(storage.NewMemoryStore(), false) d := dao.NewSimple(storage.NewMemoryStore(), false)

View File

@ -20,7 +20,7 @@ import (
// Lub represents Lub native contract (utility/fee token - lubrication). // Lub represents Lub native contract (utility/fee token - lubrication).
type Lub struct { type Lub struct {
nep17TokenNative nep17TokenNative
Annos IAnnos Tutus ITutus
Policy IPolicy Policy IPolicy
Vita IVita // For checking local Vita status Vita IVita // For checking local Vita status
Federation IFederation // For visiting Vita and fee split Federation IFederation // For visiting Vita and fee split
@ -45,7 +45,7 @@ const (
) )
// LubFactor is a divisor for finding Lub integral value. // LubFactor is a divisor for finding Lub integral value.
const LubFactor = AnnosTotalSupply const LubFactor = TutusTotalSupply
// newLub returns Lub native contract. // newLub returns Lub native contract.
func newLub(init int64) *Lub { func newLub(init int64) *Lub {
@ -155,7 +155,7 @@ func (g *Lub) OnPersist(ic *interop.Context) error {
g.Burn(ic, sender, absAmount) g.Burn(ic, sender, absAmount)
} }
} }
validators := g.Annos.GetNextBlockValidatorsInternal(ic.DAO) validators := g.Tutus.GetNextBlockValidatorsInternal(ic.DAO)
primary := validators[ic.Block.PrimaryIndex].GetScriptHash() primary := validators[ic.Block.PrimaryIndex].GetScriptHash()
var netFee int64 var netFee int64
for _, tx := range ic.Block.Transactions { for _, tx := range ic.Block.Transactions {

File diff suppressed because one or more lines are too long

View File

@ -51,12 +51,12 @@ func newNeoCommitteeClient(t *testing.T, expectedGASBalance int) *neotest.Contra
e.ValidatorInvoker(e.NativeHash(t, nativenames.Lub)).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.Annos)) return e.CommitteeInvoker(e.NativeHash(t, nativenames.Tutus))
} }
func newNeoValidatorsClient(t *testing.T) *neotest.ContractInvoker { func newNeoValidatorsClient(t *testing.T) *neotest.ContractInvoker {
c := newNeoCommitteeClient(t, 100_0000_0000) c := newNeoCommitteeClient(t, 100_0000_0000)
return c.ValidatorInvoker(c.NativeHash(t, nativenames.Annos)) return c.ValidatorInvoker(c.NativeHash(t, nativenames.Tutus))
} }
func TestNEO_GasPerBlock(t *testing.T) { func TestNEO_GasPerBlock(t *testing.T) {
@ -76,7 +76,7 @@ func TestNEO_RegisterPriceCache(t *testing.T) {
} }
func TestNEO_CandidateEvents(t *testing.T) { func TestNEO_CandidateEvents(t *testing.T) {
c := newNativeClient(t, nativenames.Annos) c := newNativeClient(t, nativenames.Tutus)
singleSigner := c.Signers[0].(neotest.MultiSigner).Single(0) singleSigner := c.Signers[0].(neotest.MultiSigner).Single(0)
cc := c.WithSigners(c.Signers[0], singleSigner) cc := c.WithSigners(c.Signers[0], singleSigner)
e := c.Executor e := c.Executor
@ -491,7 +491,7 @@ func TestNEO_GetAccountState(t *testing.T) {
neoValidatorInvoker.WithSigners(acc).Invoke(t, true, "transfer", acc.ScriptHash(), acc.ScriptHash(), amount, nil) neoValidatorInvoker.WithSigners(acc).Invoke(t, true, "transfer", acc.ScriptHash(), acc.ScriptHash(), amount, nil)
as = getAccountState(t, acc.ScriptHash()) as = getAccountState(t, acc.ScriptHash())
expect := GasPerBlock * native.LubFactor * VoterRewardRatio / 100 * (uint64(e.Chain.BlockHeight()) / uint64(committeeSize)) expect := GasPerBlock * native.LubFactor * VoterRewardRatio / 100 * (uint64(e.Chain.BlockHeight()) / uint64(committeeSize))
expect = expect * uint64(committeeSize) / uint64(validatorSize+committeeSize) * native.AnnosTotalSupply / as.Balance.Uint64() expect = expect * uint64(committeeSize) / uint64(validatorSize+committeeSize) * native.TutusTotalSupply / as.Balance.Uint64()
require.Equal(t, e.Chain.BlockHeight(), as.BalanceHeight) require.Equal(t, e.Chain.BlockHeight(), as.BalanceHeight)
require.Equal(t, expect, as.LastGasPerVote.Uint64()) require.Equal(t, expect, as.LastGasPerVote.Uint64())
}) })
@ -548,7 +548,7 @@ func TestNEO_GetAccountStateInteropAPI(t *testing.T) {
VoterRewardRatio = 80 VoterRewardRatio = 80
) )
expect := GasPerBlock * native.LubFactor * VoterRewardRatio / 100 * (uint64(e.Chain.BlockHeight()) / uint64(committeeSize)) expect := GasPerBlock * native.LubFactor * VoterRewardRatio / 100 * (uint64(e.Chain.BlockHeight()) / uint64(committeeSize))
expect = expect * uint64(committeeSize) / uint64(validatorSize+committeeSize) * native.AnnosTotalSupply / uint64(amount) expect = expect * uint64(committeeSize) / uint64(validatorSize+committeeSize) * native.TutusTotalSupply / uint64(amount)
ctrInvoker := e.NewInvoker(ctr.Hash, e.Committee) ctrInvoker := e.NewInvoker(ctr.Hash, e.Committee)
ctrInvoker.Invoke(t, stackitem.Make(expect), "getLastGasPerVote") ctrInvoker.Invoke(t, stackitem.Make(expect), "getLastGasPerVote")
} }
@ -613,7 +613,7 @@ func TestNEO_TransferOnPayment(t *testing.T) {
ScriptHash: cs.Hash, ScriptHash: cs.Hash,
Name: "LastPaymentNEP17", Name: "LastPaymentNEP17",
Item: stackitem.NewArray([]stackitem.Item{ Item: stackitem.NewArray([]stackitem.Item{
stackitem.NewByteArray(e.NativeHash(t, nativenames.Annos).BytesBE()), stackitem.NewByteArray(e.NativeHash(t, nativenames.Tutus).BytesBE()),
stackitem.NewByteArray(e.Validator.ScriptHash().BytesBE()), stackitem.NewByteArray(e.Validator.ScriptHash().BytesBE()),
stackitem.NewBigInteger(big.NewInt(amount)), stackitem.NewBigInteger(big.NewInt(amount)),
stackitem.Null{}, stackitem.Null{},
@ -921,7 +921,7 @@ func TestNEO_RegisterViaNEP27(t *testing.T) {
neoCommitteeInvoker := newNeoCommitteeClient(t, 100_0000_0000) neoCommitteeInvoker := newNeoCommitteeClient(t, 100_0000_0000)
neoValidatorsInvoker := neoCommitteeInvoker.WithSigners(neoCommitteeInvoker.Validator) neoValidatorsInvoker := neoCommitteeInvoker.WithSigners(neoCommitteeInvoker.Validator)
e := neoCommitteeInvoker.Executor e := neoCommitteeInvoker.Executor
neoHash := e.NativeHash(t, nativenames.Annos) neoHash := e.NativeHash(t, nativenames.Tutus)
cfg := e.Chain.GetConfig() cfg := e.Chain.GetConfig()
candidatesCount := cfg.GetCommitteeSize(0) - 1 candidatesCount := cfg.GetCommitteeSize(0) - 1

View File

@ -51,7 +51,7 @@ func TestNotary_MaxNotValidBeforeDeltaCache(t *testing.T) {
func TestNotary_Pipeline(t *testing.T) { func TestNotary_Pipeline(t *testing.T) {
notaryCommitteeInvoker := newNotaryClient(t) notaryCommitteeInvoker := newNotaryClient(t)
e := notaryCommitteeInvoker.Executor e := notaryCommitteeInvoker.Executor
annosCommitteeInvoker := e.CommitteeInvoker(e.NativeHash(t, nativenames.Annos)) annosCommitteeInvoker := e.CommitteeInvoker(e.NativeHash(t, nativenames.Tutus))
lubCommitteeInvoker := e.CommitteeInvoker(e.NativeHash(t, nativenames.Lub)) lubCommitteeInvoker := e.CommitteeInvoker(e.NativeHash(t, nativenames.Lub))
notaryHash := notaryCommitteeInvoker.NativeHash(t, nativenames.Notary) notaryHash := notaryCommitteeInvoker.NativeHash(t, nativenames.Notary)
@ -76,7 +76,7 @@ func TestNotary_Pipeline(t *testing.T) {
notaryCommitteeInvoker.Invoke(t, false, "lockDepositUntil", multisigHash, int64(depositLock+1)) notaryCommitteeInvoker.Invoke(t, false, "lockDepositUntil", multisigHash, int64(depositLock+1))
// `onPayment`: bad token // `onPayment`: bad token
annosCommitteeInvoker.InvokeFail(t, "only GAS can be accepted for deposit", "transfer", multisigHash, notaryHash, int64(1), &notary.OnNEP17PaymentData{Till: uint32(depositLock)}) annosCommitteeInvoker.InvokeFail(t, "only Lub can be accepted for deposit", "transfer", multisigHash, notaryHash, int64(1), &notary.OnNEP17PaymentData{Till: uint32(depositLock)})
// `onPayment`: insufficient first deposit // `onPayment`: insufficient first deposit
lubCommitteeInvoker.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)})

View File

@ -2,6 +2,7 @@ package native_test
import ( import (
"testing" "testing"
"time"
"github.com/nspcc-dev/neo-go/pkg/crypto/hash" "github.com/nspcc-dev/neo-go/pkg/crypto/hash"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -229,13 +230,14 @@ func TestOpus_RegisterOperatorWithVita(t *testing.T) {
personHash := hash.Sha256(owner.BytesBE()).BytesBE() personHash := hash.Sha256(owner.BytesBE()).BytesBE()
isEntity := false isEntity := false
recoveryHash := hash.Sha256([]byte("recovery")).BytesBE() recoveryHash := hash.Sha256([]byte("recovery")).BytesBE()
birthTimestamp := time.Now().Unix() - 30*365*24*60*60 // 30 years old
// Register Vita token // Register Vita token
vitaInvoker.InvokeAndCheck(t, func(t testing.TB, stack []stackitem.Item) { vitaInvoker.InvokeAndCheck(t, func(t testing.TB, stack []stackitem.Item) {
require.Equal(t, 1, len(stack)) require.Equal(t, 1, len(stack))
_, ok := stack[0].Value().([]byte) _, ok := stack[0].Value().([]byte)
require.True(t, ok, "expected ByteArray result") require.True(t, ok, "expected ByteArray result")
}, "register", owner.BytesBE(), personHash, isEntity, recoveryHash) }, "register", owner.BytesBE(), personHash, isEntity, recoveryHash, birthTimestamp)
// Now register operator (only takes owner as parameter) // Now register operator (only takes owner as parameter)
opusInvoker := c.WithSigners(acc) opusInvoker := c.WithSigners(acc)

View File

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

View File

@ -2,6 +2,7 @@ package native_test
import ( import (
"testing" "testing"
"time"
"github.com/nspcc-dev/neo-go/pkg/crypto/hash" "github.com/nspcc-dev/neo-go/pkg/crypto/hash"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -175,13 +176,14 @@ func TestSalus_ActivateHealthcareWithVita(t *testing.T) {
personHash := hash.Sha256(owner.BytesBE()).BytesBE() personHash := hash.Sha256(owner.BytesBE()).BytesBE()
isEntity := false isEntity := false
recoveryHash := hash.Sha256([]byte("recovery")).BytesBE() recoveryHash := hash.Sha256([]byte("recovery")).BytesBE()
birthTimestamp := time.Now().Unix() - 30*365*24*60*60 // 30 years old
// Register Vita token // Register Vita token
vitaInvoker.InvokeAndCheck(t, func(t testing.TB, stack []stackitem.Item) { vitaInvoker.InvokeAndCheck(t, func(t testing.TB, stack []stackitem.Item) {
require.Equal(t, 1, len(stack)) require.Equal(t, 1, len(stack))
_, ok := stack[0].Value().([]byte) _, ok := stack[0].Value().([]byte)
require.True(t, ok, "expected ByteArray result") require.True(t, ok, "expected ByteArray result")
}, "register", owner.BytesBE(), personHash, isEntity, recoveryHash) }, "register", owner.BytesBE(), personHash, isEntity, recoveryHash, birthTimestamp)
// Now activate Salus account - need to pass owner as BytesBE for Hash160 type // Now activate Salus account - need to pass owner as BytesBE for Hash160 type
salusInvoker := c.WithSigners(acc) salusInvoker := c.WithSigners(acc)
@ -213,13 +215,14 @@ func TestSalus_AllocateCredits(t *testing.T) {
personHash := hash.Sha256(owner.BytesBE()).BytesBE() personHash := hash.Sha256(owner.BytesBE()).BytesBE()
isEntity := false isEntity := false
recoveryHash := hash.Sha256([]byte("recovery")).BytesBE() recoveryHash := hash.Sha256([]byte("recovery")).BytesBE()
birthTimestamp := time.Now().Unix() - 30*365*24*60*60 // 30 years old
// Register returns ByteArray (tokenID), not Null // Register returns ByteArray (tokenID), not Null
vitaInvoker.InvokeAndCheck(t, func(t testing.TB, stack []stackitem.Item) { vitaInvoker.InvokeAndCheck(t, func(t testing.TB, stack []stackitem.Item) {
require.Equal(t, 1, len(stack)) require.Equal(t, 1, len(stack))
_, ok := stack[0].Value().([]byte) _, ok := stack[0].Value().([]byte)
require.True(t, ok, "expected ByteArray result") require.True(t, ok, "expected ByteArray result")
}, "register", owner.BytesBE(), personHash, isEntity, recoveryHash) }, "register", owner.BytesBE(), personHash, isEntity, recoveryHash, birthTimestamp)
// Activate Salus account - use BytesBE for Hash160 // Activate Salus account - use BytesBE for Hash160
salusInvoker := c.WithSigners(acc) salusInvoker := c.WithSigners(acc)

View File

@ -2,6 +2,7 @@ package native_test
import ( import (
"testing" "testing"
"time"
"github.com/nspcc-dev/neo-go/pkg/crypto/hash" "github.com/nspcc-dev/neo-go/pkg/crypto/hash"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -160,13 +161,14 @@ func TestScire_CreateAccountWithVita(t *testing.T) {
personHash := hash.Sha256(owner.BytesBE()).BytesBE() personHash := hash.Sha256(owner.BytesBE()).BytesBE()
isEntity := false isEntity := false
recoveryHash := hash.Sha256([]byte("recovery")).BytesBE() recoveryHash := hash.Sha256([]byte("recovery")).BytesBE()
birthTimestamp := time.Now().Unix() - 30*365*24*60*60 // 30 years old
// Register Vita token // Register Vita token
vitaInvoker.InvokeAndCheck(t, func(t testing.TB, stack []stackitem.Item) { vitaInvoker.InvokeAndCheck(t, func(t testing.TB, stack []stackitem.Item) {
require.Equal(t, 1, len(stack)) require.Equal(t, 1, len(stack))
_, ok := stack[0].Value().([]byte) _, ok := stack[0].Value().([]byte)
require.True(t, ok, "expected ByteArray result") require.True(t, ok, "expected ByteArray result")
}, "register", owner.BytesBE(), personHash, isEntity, recoveryHash) }, "register", owner.BytesBE(), personHash, isEntity, recoveryHash, birthTimestamp)
// Now create Scire account - need to pass owner as BytesBE for Hash160 type // Now create Scire account - need to pass owner as BytesBE for Hash160 type
scireInvoker := c.WithSigners(acc) scireInvoker := c.WithSigners(acc)
@ -198,13 +200,14 @@ func TestScire_AllocateCredits(t *testing.T) {
personHash := hash.Sha256(owner.BytesBE()).BytesBE() personHash := hash.Sha256(owner.BytesBE()).BytesBE()
isEntity := false isEntity := false
recoveryHash := hash.Sha256([]byte("recovery")).BytesBE() recoveryHash := hash.Sha256([]byte("recovery")).BytesBE()
birthTimestamp := time.Now().Unix() - 30*365*24*60*60 // 30 years old
// Register returns ByteArray (tokenID), not Null // Register returns ByteArray (tokenID), not Null
vitaInvoker.InvokeAndCheck(t, func(t testing.TB, stack []stackitem.Item) { vitaInvoker.InvokeAndCheck(t, func(t testing.TB, stack []stackitem.Item) {
require.Equal(t, 1, len(stack)) require.Equal(t, 1, len(stack))
_, ok := stack[0].Value().([]byte) _, ok := stack[0].Value().([]byte)
require.True(t, ok, "expected ByteArray result") require.True(t, ok, "expected ByteArray result")
}, "register", owner.BytesBE(), personHash, isEntity, recoveryHash) }, "register", owner.BytesBE(), personHash, isEntity, recoveryHash, birthTimestamp)
// Create Scire account - use BytesBE for Hash160 // Create Scire account - use BytesBE for Hash160
scireInvoker := c.WithSigners(acc) scireInvoker := c.WithSigners(acc)

View File

@ -2,6 +2,7 @@ package native_test
import ( import (
"testing" "testing"
"time"
"github.com/nspcc-dev/neo-go/pkg/crypto/hash" "github.com/nspcc-dev/neo-go/pkg/crypto/hash"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -214,13 +215,14 @@ func TestSese_ActivateLifePlanWithVita(t *testing.T) {
personHash := hash.Sha256(owner.BytesBE()).BytesBE() personHash := hash.Sha256(owner.BytesBE()).BytesBE()
isEntity := false isEntity := false
recoveryHash := hash.Sha256([]byte("recovery")).BytesBE() recoveryHash := hash.Sha256([]byte("recovery")).BytesBE()
birthTimestamp := time.Now().Unix() - 30*365*24*60*60 // 30 years old
// Register Vita token // Register Vita token
vitaInvoker.InvokeAndCheck(t, func(t testing.TB, stack []stackitem.Item) { vitaInvoker.InvokeAndCheck(t, func(t testing.TB, stack []stackitem.Item) {
require.Equal(t, 1, len(stack)) require.Equal(t, 1, len(stack))
_, ok := stack[0].Value().([]byte) _, ok := stack[0].Value().([]byte)
require.True(t, ok, "expected ByteArray result") require.True(t, ok, "expected ByteArray result")
}, "register", owner.BytesBE(), personHash, isEntity, recoveryHash) }, "register", owner.BytesBE(), personHash, isEntity, recoveryHash, birthTimestamp)
// Now activate Sese account - need to pass owner as BytesBE for Hash160 type // Now activate Sese account - need to pass owner as BytesBE for Hash160 type
seseInvoker := c.WithSigners(acc) seseInvoker := c.WithSigners(acc)
@ -255,13 +257,14 @@ func TestSese_Contribute(t *testing.T) {
personHash := hash.Sha256(owner.BytesBE()).BytesBE() personHash := hash.Sha256(owner.BytesBE()).BytesBE()
isEntity := false isEntity := false
recoveryHash := hash.Sha256([]byte("recovery")).BytesBE() recoveryHash := hash.Sha256([]byte("recovery")).BytesBE()
birthTimestamp := time.Now().Unix() - 30*365*24*60*60 // 30 years old
// Register Vita token // Register Vita token
vitaInvoker.InvokeAndCheck(t, func(t testing.TB, stack []stackitem.Item) { vitaInvoker.InvokeAndCheck(t, func(t testing.TB, stack []stackitem.Item) {
require.Equal(t, 1, len(stack)) require.Equal(t, 1, len(stack))
_, ok := stack[0].Value().([]byte) _, ok := stack[0].Value().([]byte)
require.True(t, ok, "expected ByteArray result") require.True(t, ok, "expected ByteArray result")
}, "register", owner.BytesBE(), personHash, isEntity, recoveryHash) }, "register", owner.BytesBE(), personHash, isEntity, recoveryHash, birthTimestamp)
// Activate Sese account // Activate Sese account
seseInvoker := c.WithSigners(acc) seseInvoker := c.WithSigners(acc)
@ -288,11 +291,12 @@ func TestSese_StartCareer(t *testing.T) {
personHash := hash.Sha256(owner.BytesBE()).BytesBE() personHash := hash.Sha256(owner.BytesBE()).BytesBE()
isEntity := false isEntity := false
recoveryHash := hash.Sha256([]byte("recovery")).BytesBE() recoveryHash := hash.Sha256([]byte("recovery")).BytesBE()
birthTimestamp := time.Now().Unix() - 30*365*24*60*60 // 30 years old
// Register Vita token // Register Vita token
vitaInvoker.InvokeAndCheck(t, func(t testing.TB, stack []stackitem.Item) { vitaInvoker.InvokeAndCheck(t, func(t testing.TB, stack []stackitem.Item) {
require.Equal(t, 1, len(stack)) require.Equal(t, 1, len(stack))
}, "register", owner.BytesBE(), personHash, isEntity, recoveryHash) }, "register", owner.BytesBE(), personHash, isEntity, recoveryHash, birthTimestamp)
// Activate Sese account // Activate Sese account
seseInvoker := c.WithSigners(acc) seseInvoker := c.WithSigners(acc)
@ -330,11 +334,12 @@ func TestSese_CreateGoal(t *testing.T) {
personHash := hash.Sha256(owner.BytesBE()).BytesBE() personHash := hash.Sha256(owner.BytesBE()).BytesBE()
isEntity := false isEntity := false
recoveryHash := hash.Sha256([]byte("recovery")).BytesBE() recoveryHash := hash.Sha256([]byte("recovery")).BytesBE()
birthTimestamp := time.Now().Unix() - 30*365*24*60*60 // 30 years old
// Register Vita token // Register Vita token
vitaInvoker.InvokeAndCheck(t, func(t testing.TB, stack []stackitem.Item) { vitaInvoker.InvokeAndCheck(t, func(t testing.TB, stack []stackitem.Item) {
require.Equal(t, 1, len(stack)) require.Equal(t, 1, len(stack))
}, "register", owner.BytesBE(), personHash, isEntity, recoveryHash) }, "register", owner.BytesBE(), personHash, isEntity, recoveryHash, birthTimestamp)
// Activate Sese account // Activate Sese account
seseInvoker := c.WithSigners(acc) seseInvoker := c.WithSigners(acc)

View File

@ -2,6 +2,7 @@ package native_test
import ( import (
"testing" "testing"
"time"
"github.com/nspcc-dev/neo-go/pkg/crypto/hash" "github.com/nspcc-dev/neo-go/pkg/crypto/hash"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -262,13 +263,14 @@ func TestTribute_CreateVelocityAccountWithVita(t *testing.T) {
personHash := hash.Sha256(owner.BytesBE()).BytesBE() personHash := hash.Sha256(owner.BytesBE()).BytesBE()
isEntity := false isEntity := false
recoveryHash := hash.Sha256([]byte("recovery")).BytesBE() recoveryHash := hash.Sha256([]byte("recovery")).BytesBE()
birthTimestamp := time.Now().Unix() - 30*365*24*60*60 // 30 years old
// Register Vita token // Register Vita token
vitaInvoker.InvokeAndCheck(t, func(t testing.TB, stack []stackitem.Item) { vitaInvoker.InvokeAndCheck(t, func(t testing.TB, stack []stackitem.Item) {
require.Equal(t, 1, len(stack)) require.Equal(t, 1, len(stack))
_, ok := stack[0].Value().([]byte) _, ok := stack[0].Value().([]byte)
require.True(t, ok, "expected ByteArray result") require.True(t, ok, "expected ByteArray result")
}, "register", owner.BytesBE(), personHash, isEntity, recoveryHash) }, "register", owner.BytesBE(), personHash, isEntity, recoveryHash, birthTimestamp)
// Now create Tribute account // Now create Tribute account
tributeInvoker := c.WithSigners(acc) tributeInvoker := c.WithSigners(acc)

View File

@ -2,6 +2,7 @@ package native_test
import ( import (
"testing" "testing"
"time"
"github.com/nspcc-dev/neo-go/pkg/crypto/hash" "github.com/nspcc-dev/neo-go/pkg/crypto/hash"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -22,6 +23,7 @@ func registerVita(t *testing.T, c *neotest.ContractInvoker, signer neotest.Signe
personHash := hash.Sha256(owner.BytesBE()).BytesBE() personHash := hash.Sha256(owner.BytesBE()).BytesBE()
isEntity := false isEntity := false
recoveryHash := hash.Sha256([]byte("recovery")).BytesBE() recoveryHash := hash.Sha256([]byte("recovery")).BytesBE()
birthTimestamp := time.Now().Unix() - 30*365*24*60*60 // Default: 30 years old
invoker := c.WithSigners(signer) invoker := c.WithSigners(signer)
// Register returns tokenID bytes, not null // Register returns tokenID bytes, not null
@ -30,7 +32,7 @@ func registerVita(t *testing.T, c *neotest.ContractInvoker, signer neotest.Signe
// Result is a ByteArray (tokenID) // Result is a ByteArray (tokenID)
_, ok := stack[0].Value().([]byte) _, ok := stack[0].Value().([]byte)
require.True(t, ok, "expected ByteArray result") require.True(t, ok, "expected ByteArray result")
}, "register", owner.BytesBE(), personHash, isEntity, recoveryHash) }, "register", owner.BytesBE(), personHash, isEntity, recoveryHash, birthTimestamp)
aer := c.Executor.GetTxExecResult(t, txHash) aer := c.Executor.GetTxExecResult(t, txHash)
require.Equal(t, 1, len(aer.Stack)) require.Equal(t, 1, len(aer.Stack))
@ -48,6 +50,7 @@ func TestVita_Register(t *testing.T) {
personHash := hash.Sha256(owner.BytesBE()).BytesBE() personHash := hash.Sha256(owner.BytesBE()).BytesBE()
isEntity := false isEntity := false
recoveryHash := hash.Sha256([]byte("recovery")).BytesBE() recoveryHash := hash.Sha256([]byte("recovery")).BytesBE()
birthTimestamp := time.Now().Unix() - 30*365*24*60*60 // 30 years old
invoker := c.WithSigners(acc) invoker := c.WithSigners(acc)
@ -56,12 +59,13 @@ func TestVita_Register(t *testing.T) {
require.Equal(t, 1, len(stack)) require.Equal(t, 1, len(stack))
_, ok := stack[0].Value().([]byte) _, ok := stack[0].Value().([]byte)
require.True(t, ok, "expected ByteArray result") require.True(t, ok, "expected ByteArray result")
}, "register", owner.BytesBE(), personHash, isEntity, recoveryHash) }, "register", owner.BytesBE(), personHash, isEntity, recoveryHash, birthTimestamp)
// Check event was emitted // Check events were emitted (BirthRegistered from Annos + VitaCreated)
aer := e.GetTxExecResult(t, txHash) aer := e.GetTxExecResult(t, txHash)
require.Equal(t, 1, len(aer.Events)) require.Equal(t, 2, len(aer.Events))
require.Equal(t, "VitaCreated", aer.Events[0].Name) require.Equal(t, "BirthRegistered", aer.Events[0].Name)
require.Equal(t, "VitaCreated", aer.Events[1].Name)
// Check exists returns true // Check exists returns true
invoker.Invoke(t, true, "exists", owner.BytesBE()) invoker.Invoke(t, true, "exists", owner.BytesBE())

View File

@ -2,6 +2,7 @@ package native_test
import ( import (
"testing" "testing"
"time"
"github.com/nspcc-dev/neo-go/pkg/crypto/hash" "github.com/nspcc-dev/neo-go/pkg/crypto/hash"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -25,12 +26,13 @@ func registerVitaForVTS(t *testing.T, e *neotest.Executor, acc neotest.Signer) {
personHash := hash.Sha256(owner.BytesBE()).BytesBE() personHash := hash.Sha256(owner.BytesBE()).BytesBE()
isEntity := false isEntity := false
recoveryHash := hash.Sha256([]byte("recovery")).BytesBE() recoveryHash := hash.Sha256([]byte("recovery")).BytesBE()
birthTimestamp := time.Now().Unix() - 30*365*24*60*60 // Default: 30 years old
c.InvokeAndCheck(t, func(t testing.TB, stack []stackitem.Item) { c.InvokeAndCheck(t, func(t testing.TB, stack []stackitem.Item) {
require.Equal(t, 1, len(stack)) require.Equal(t, 1, len(stack))
_, ok := stack[0].Value().([]byte) _, ok := stack[0].Value().([]byte)
require.True(t, ok, "expected ByteArray result for tokenID") require.True(t, ok, "expected ByteArray result for tokenID")
}, "register", owner.BytesBE(), personHash, isEntity, recoveryHash) }, "register", owner.BytesBE(), personHash, isEntity, recoveryHash, birthTimestamp)
} }
// addAgeVerifiedAttribute adds the "age_verified" attribute to an account's Vita. // addAgeVerifiedAttribute adds the "age_verified" attribute to an account's Vita.

View File

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

View File

@ -31,7 +31,7 @@ import (
type Notary struct { type Notary struct {
interop.ContractMD interop.ContractMD
Lub ILub Lub ILub
Annos IAnnos Tutus ITutus
Desig IDesignate Desig IDesignate
Policy IPolicy Policy IPolicy
} }
@ -434,7 +434,7 @@ func (n *Notary) setMaxNotValidBeforeDelta(ic *interop.Context, args []stackitem
if value > maxInc/2 || value < uint32(cfg.GetNumOfCNs(ic.BlockHeight())) { 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()))) panic(fmt.Errorf("MaxNotValidBeforeDelta cannot be more than %d or less than %d", maxInc/2, cfg.GetNumOfCNs(ic.BlockHeight())))
} }
if !n.Annos.CheckCommittee(ic) { if !n.Tutus.CheckCommittee(ic) {
panic("invalid committee signature") panic("invalid committee signature")
} }
setIntWithKey(n.ID, ic.DAO, maxNotValidBeforeDeltaKey, int64(value)) setIntWithKey(n.ID, ic.DAO, maxNotValidBeforeDeltaKey, int64(value))

View File

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

View File

@ -34,7 +34,7 @@ import (
type Oracle struct { type Oracle struct {
interop.ContractMD interop.ContractMD
Lub ILub Lub ILub
Annos IAnnos Tutus ITutus
Desig IDesignate Desig IDesignate
oracleScript []byte oracleScript []byte
@ -518,7 +518,7 @@ func (o *Oracle) setPrice(ic *interop.Context, args []stackitem.Item) stackitem.
if price.Sign() <= 0 || !price.IsInt64() { if price.Sign() <= 0 || !price.IsInt64() {
panic("invalid register price") panic("invalid register price")
} }
if !o.Annos.CheckCommittee(ic) { if !o.Tutus.CheckCommittee(ic) {
panic("invalid committee signature") panic("invalid committee signature")
} }
setIntWithKey(o.ID, ic.DAO, prefixRequestPrice, price.Int64()) setIntWithKey(o.ID, ic.DAO, prefixRequestPrice, price.Int64())

View File

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

View File

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

View File

@ -26,7 +26,7 @@ import (
// - Education and healthcare credential portability // - Education and healthcare credential portability
type Pons struct { type Pons struct {
interop.ContractMD interop.ContractMD
Annos IAnnos Tutus ITutus
Vita IVita Vita IVita
Federation *Federation Federation *Federation
RoleRegistry *RoleRegistry 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 { func (p *Pons) setLocalChainID(ic *interop.Context, args []stackitem.Item) stackitem.Item {
chainID := uint32(toBigInt(args[0]).Int64()) chainID := uint32(toBigInt(args[0]).Int64())
if !p.Annos.CheckCommittee(ic) { if !p.Tutus.CheckCommittee(ic) {
panic("only committee can set chain ID") 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()) expirationHeight := uint32(toBigInt(args[3]).Int64())
if !p.Annos.CheckCommittee(ic) { if !p.Tutus.CheckCommittee(ic) {
panic("only committee can create agreements") 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() agreementID := toBigInt(args[0]).Uint64()
newStatus := state.AgreementStatus(toBigInt(args[1]).Int64()) newStatus := state.AgreementStatus(toBigInt(args[1]).Int64())
if !p.Annos.CheckCommittee(ic) { if !p.Tutus.CheckCommittee(ic) {
panic("only committee can update agreement status") panic("only committee can update agreement status")
} }
@ -930,7 +930,7 @@ func (p *Pons) respondVerification(ic *interop.Context, args []stackitem.Item) s
panic(err) panic(err)
} }
if !p.Annos.CheckCommittee(ic) { if !p.Tutus.CheckCommittee(ic) {
panic("only committee can respond to verification requests") 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) panic(err)
} }
if !p.Annos.CheckCommittee(ic) { if !p.Tutus.CheckCommittee(ic) {
panic("only committee can complete settlements") 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 // Allow sender or committee to cancel
caller := ic.VM.GetCallingScriptHash() caller := ic.VM.GetCallingScriptHash()
if !caller.Equals(sr.Sender) && !p.Annos.CheckCommittee(ic) { if !caller.Equals(sr.Sender) && !p.Tutus.CheckCommittee(ic) {
panic("only sender or committee can cancel settlement") 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 // Allow owner or committee to revoke
caller := ic.VM.GetCallingScriptHash() caller := ic.VM.GetCallingScriptHash()
if !caller.Equals(cs.Owner) && !p.Annos.CheckCommittee(ic) { if !caller.Equals(cs.Owner) && !p.Tutus.CheckCommittee(ic) {
panic(ErrNotCredentialOwner) panic(ErrNotCredentialOwner)
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -18,7 +18,7 @@ import (
// Treasury represents Treasury native contract. // Treasury represents Treasury native contract.
type Treasury struct { type Treasury struct {
interop.ContractMD interop.ContractMD
Annos IAnnos Tutus ITutus
} }
// Storage key prefixes for Treasury. // 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 { func (t *Treasury) verify(ic *interop.Context, _ []stackitem.Item) stackitem.Item {
return stackitem.NewBool(t.Annos.CheckCommittee(ic)) return stackitem.NewBool(t.Tutus.CheckCommittee(ic))
} }
func (t *Treasury) onNEP11Payment(ic *interop.Context, args []stackitem.Item) stackitem.Item { 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. // Tribute represents the anti-hoarding economics native contract.
type Tribute struct { type Tribute struct {
interop.ContractMD interop.ContractMD
Annos IAnnos Tutus ITutus
Vita IVita Vita IVita
VTS IVTS VTS IVTS
RoleRegistry IRoleRegistry RoleRegistry IRoleRegistry
@ -120,7 +120,7 @@ func (t *Tribute) checkCommittee(ic *interop.Context) bool {
if t.RoleRegistry != nil { if t.RoleRegistry != nil {
return t.RoleRegistry.CheckCommittee(ic) return t.RoleRegistry.CheckCommittee(ic)
} }
return t.Annos.CheckCommittee(ic) return t.Tutus.CheckCommittee(ic)
} }
// checkTributeAdmin checks if the caller has tribute admin authority. // checkTributeAdmin checks if the caller has tribute admin authority.

View File

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

View File

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