[#23] *: Replace engine.AppCall with contract.Call

This commit is contained in:
Alex Vanin 2020-12-10 17:45:45 +03:00 committed by Alex Vanin
parent e17d0f4d97
commit 189a83d9d6
13 changed files with 72 additions and 83 deletions

View file

@ -4,7 +4,6 @@ import (
"github.com/nspcc-dev/neo-go/pkg/interop/binary"
"github.com/nspcc-dev/neo-go/pkg/interop/contract"
"github.com/nspcc-dev/neo-go/pkg/interop/crypto"
"github.com/nspcc-dev/neo-go/pkg/interop/engine"
"github.com/nspcc-dev/neo-go/pkg/interop/runtime"
"github.com/nspcc-dev/neo-go/pkg/interop/storage"
"github.com/nspcc-dev/neo-go/pkg/interop/util"
@ -79,18 +78,18 @@ func Neo() int {
}
func balance(hash string, addr []byte) int {
balance := engine.AppCall([]byte(hash), "balanceOf", addr)
balance := contract.Call([]byte(hash), "balanceOf", addr)
return balance.(int)
}
func irList() []irNode {
netmapContractAddr := storage.Get(ctx, netmapContractKey).([]byte)
return engine.AppCall(netmapContractAddr, "innerRingList").([]irNode)
return contract.Call(netmapContractAddr, "innerRingList").([]irNode)
}
func currentEpoch() int {
netmapContractAddr := storage.Get(ctx, netmapContractKey).([]byte)
return engine.AppCall(netmapContractAddr, "epoch").(int)
return contract.Call(netmapContractAddr, "epoch").(int)
}
func checkPermission(ir []irNode) bool {
@ -126,7 +125,7 @@ func Emit() bool {
contractHash := runtime.GetExecutingScriptHash()
neo := balance(neoHash, contractHash)
_ = engine.AppCall([]byte(neoHash), "transfer", contractHash, contractHash, neo)
_ = contract.Call([]byte(neoHash), "transfer", contractHash, contractHash, neo)
gas := balance(gasHash, contractHash)
gasPerNode := gas * 7 / 8 / len(innerRingKeys)
@ -140,7 +139,7 @@ func Emit() bool {
node := innerRingKeys[i]
address := contract.CreateStandardAccount(node.key)
_ = engine.AppCall([]byte(gasHash), "transfer", contractHash, address, gasPerNode)
_ = contract.Call([]byte(gasHash), "transfer", contractHash, address, gasPerNode)
}
runtime.Log("utility token has been emitted to inner ring nodes")
@ -167,7 +166,7 @@ func Vote(epoch int, candidates [][]byte) {
candidate := candidates[index%len(candidates)]
address := runtime.GetExecutingScriptHash()
ok := engine.AppCall([]byte(neoHash), "vote", address, candidate).(bool)
ok := contract.Call([]byte(neoHash), "vote", address, candidate).(bool)
if ok {
runtime.Log(name + ": successfully voted for validator")
removeVotes(ctx, id)

View file

@ -4,7 +4,6 @@ import (
"github.com/nspcc-dev/neo-go/pkg/interop/binary"
"github.com/nspcc-dev/neo-go/pkg/interop/contract"
"github.com/nspcc-dev/neo-go/pkg/interop/crypto"
"github.com/nspcc-dev/neo-go/pkg/interop/engine"
"github.com/nspcc-dev/neo-go/pkg/interop/runtime"
"github.com/nspcc-dev/neo-go/pkg/interop/storage"
"github.com/nspcc-dev/neo-go/pkg/interop/util"
@ -79,18 +78,18 @@ func Neo() int {
}
func balance(hash string, addr []byte) int {
balance := engine.AppCall([]byte(hash), "balanceOf", addr)
balance := contract.Call([]byte(hash), "balanceOf", addr)
return balance.(int)
}
func irList() []irNode {
netmapContractAddr := storage.Get(ctx, netmapContractKey).([]byte)
return engine.AppCall(netmapContractAddr, "innerRingList").([]irNode)
return contract.Call(netmapContractAddr, "innerRingList").([]irNode)
}
func currentEpoch() int {
netmapContractAddr := storage.Get(ctx, netmapContractKey).([]byte)
return engine.AppCall(netmapContractAddr, "epoch").(int)
return contract.Call(netmapContractAddr, "epoch").(int)
}
func checkPermission(ir []irNode) bool {
@ -126,7 +125,7 @@ func Emit() bool {
contractHash := runtime.GetExecutingScriptHash()
neo := balance(neoHash, contractHash)
_ = engine.AppCall([]byte(neoHash), "transfer", contractHash, contractHash, neo)
_ = contract.Call([]byte(neoHash), "transfer", contractHash, contractHash, neo)
gas := balance(gasHash, contractHash)
gasPerNode := gas * 7 / 8 / len(innerRingKeys)
@ -140,7 +139,7 @@ func Emit() bool {
node := innerRingKeys[i]
address := contract.CreateStandardAccount(node.key)
_ = engine.AppCall([]byte(gasHash), "transfer", contractHash, address, gasPerNode)
_ = contract.Call([]byte(gasHash), "transfer", contractHash, address, gasPerNode)
}
runtime.Log("utility token has been emitted to inner ring nodes")
@ -167,7 +166,7 @@ func Vote(epoch int, candidates [][]byte) {
candidate := candidates[index%len(candidates)]
address := runtime.GetExecutingScriptHash()
ok := engine.AppCall([]byte(neoHash), "vote", address, candidate).(bool)
ok := contract.Call([]byte(neoHash), "vote", address, candidate).(bool)
if ok {
runtime.Log(name + ": successfully voted for validator")
removeVotes(ctx, id)

View file

@ -4,7 +4,6 @@ import (
"github.com/nspcc-dev/neo-go/pkg/interop/binary"
"github.com/nspcc-dev/neo-go/pkg/interop/contract"
"github.com/nspcc-dev/neo-go/pkg/interop/crypto"
"github.com/nspcc-dev/neo-go/pkg/interop/engine"
"github.com/nspcc-dev/neo-go/pkg/interop/runtime"
"github.com/nspcc-dev/neo-go/pkg/interop/storage"
"github.com/nspcc-dev/neo-go/pkg/interop/util"
@ -79,18 +78,18 @@ func Neo() int {
}
func balance(hash string, addr []byte) int {
balance := engine.AppCall([]byte(hash), "balanceOf", addr)
balance := contract.Call([]byte(hash), "balanceOf", addr)
return balance.(int)
}
func irList() []irNode {
netmapContractAddr := storage.Get(ctx, netmapContractKey).([]byte)
return engine.AppCall(netmapContractAddr, "innerRingList").([]irNode)
return contract.Call(netmapContractAddr, "innerRingList").([]irNode)
}
func currentEpoch() int {
netmapContractAddr := storage.Get(ctx, netmapContractKey).([]byte)
return engine.AppCall(netmapContractAddr, "epoch").(int)
return contract.Call(netmapContractAddr, "epoch").(int)
}
func checkPermission(ir []irNode) bool {
@ -126,7 +125,7 @@ func Emit() bool {
contractHash := runtime.GetExecutingScriptHash()
neo := balance(neoHash, contractHash)
_ = engine.AppCall([]byte(neoHash), "transfer", contractHash, contractHash, neo)
_ = contract.Call([]byte(neoHash), "transfer", contractHash, contractHash, neo)
gas := balance(gasHash, contractHash)
gasPerNode := gas * 7 / 8 / len(innerRingKeys)
@ -140,7 +139,7 @@ func Emit() bool {
node := innerRingKeys[i]
address := contract.CreateStandardAccount(node.key)
_ = engine.AppCall([]byte(gasHash), "transfer", contractHash, address, gasPerNode)
_ = contract.Call([]byte(gasHash), "transfer", contractHash, address, gasPerNode)
}
runtime.Log("utility token has been emitted to inner ring nodes")
@ -167,7 +166,7 @@ func Vote(epoch int, candidates [][]byte) {
candidate := candidates[index%len(candidates)]
address := runtime.GetExecutingScriptHash()
ok := engine.AppCall([]byte(neoHash), "vote", address, candidate).(bool)
ok := contract.Call([]byte(neoHash), "vote", address, candidate).(bool)
if ok {
runtime.Log(name + ": successfully voted for validator")
removeVotes(ctx, id)

View file

@ -4,7 +4,6 @@ import (
"github.com/nspcc-dev/neo-go/pkg/interop/binary"
"github.com/nspcc-dev/neo-go/pkg/interop/contract"
"github.com/nspcc-dev/neo-go/pkg/interop/crypto"
"github.com/nspcc-dev/neo-go/pkg/interop/engine"
"github.com/nspcc-dev/neo-go/pkg/interop/runtime"
"github.com/nspcc-dev/neo-go/pkg/interop/storage"
"github.com/nspcc-dev/neo-go/pkg/interop/util"
@ -79,18 +78,18 @@ func Neo() int {
}
func balance(hash string, addr []byte) int {
balance := engine.AppCall([]byte(hash), "balanceOf", addr)
balance := contract.Call([]byte(hash), "balanceOf", addr)
return balance.(int)
}
func irList() []irNode {
netmapContractAddr := storage.Get(ctx, netmapContractKey).([]byte)
return engine.AppCall(netmapContractAddr, "innerRingList").([]irNode)
return contract.Call(netmapContractAddr, "innerRingList").([]irNode)
}
func currentEpoch() int {
netmapContractAddr := storage.Get(ctx, netmapContractKey).([]byte)
return engine.AppCall(netmapContractAddr, "epoch").(int)
return contract.Call(netmapContractAddr, "epoch").(int)
}
func checkPermission(ir []irNode) bool {
@ -126,7 +125,7 @@ func Emit() bool {
contractHash := runtime.GetExecutingScriptHash()
neo := balance(neoHash, contractHash)
_ = engine.AppCall([]byte(neoHash), "transfer", contractHash, contractHash, neo)
_ = contract.Call([]byte(neoHash), "transfer", contractHash, contractHash, neo)
gas := balance(gasHash, contractHash)
gasPerNode := gas * 7 / 8 / len(innerRingKeys)
@ -140,7 +139,7 @@ func Emit() bool {
node := innerRingKeys[i]
address := contract.CreateStandardAccount(node.key)
_ = engine.AppCall([]byte(gasHash), "transfer", contractHash, address, gasPerNode)
_ = contract.Call([]byte(gasHash), "transfer", contractHash, address, gasPerNode)
}
runtime.Log("utility token has been emitted to inner ring nodes")
@ -167,7 +166,7 @@ func Vote(epoch int, candidates [][]byte) {
candidate := candidates[index%len(candidates)]
address := runtime.GetExecutingScriptHash()
ok := engine.AppCall([]byte(neoHash), "vote", address, candidate).(bool)
ok := contract.Call([]byte(neoHash), "vote", address, candidate).(bool)
if ok {
runtime.Log(name + ": successfully voted for validator")
removeVotes(ctx, id)

View file

@ -4,7 +4,6 @@ import (
"github.com/nspcc-dev/neo-go/pkg/interop/binary"
"github.com/nspcc-dev/neo-go/pkg/interop/contract"
"github.com/nspcc-dev/neo-go/pkg/interop/crypto"
"github.com/nspcc-dev/neo-go/pkg/interop/engine"
"github.com/nspcc-dev/neo-go/pkg/interop/runtime"
"github.com/nspcc-dev/neo-go/pkg/interop/storage"
"github.com/nspcc-dev/neo-go/pkg/interop/util"
@ -79,18 +78,18 @@ func Neo() int {
}
func balance(hash string, addr []byte) int {
balance := engine.AppCall([]byte(hash), "balanceOf", addr)
balance := contract.Call([]byte(hash), "balanceOf", addr)
return balance.(int)
}
func irList() []irNode {
netmapContractAddr := storage.Get(ctx, netmapContractKey).([]byte)
return engine.AppCall(netmapContractAddr, "innerRingList").([]irNode)
return contract.Call(netmapContractAddr, "innerRingList").([]irNode)
}
func currentEpoch() int {
netmapContractAddr := storage.Get(ctx, netmapContractKey).([]byte)
return engine.AppCall(netmapContractAddr, "epoch").(int)
return contract.Call(netmapContractAddr, "epoch").(int)
}
func checkPermission(ir []irNode) bool {
@ -126,7 +125,7 @@ func Emit() bool {
contractHash := runtime.GetExecutingScriptHash()
neo := balance(neoHash, contractHash)
_ = engine.AppCall([]byte(neoHash), "transfer", contractHash, contractHash, neo)
_ = contract.Call([]byte(neoHash), "transfer", contractHash, contractHash, neo)
gas := balance(gasHash, contractHash)
gasPerNode := gas * 7 / 8 / len(innerRingKeys)
@ -140,7 +139,7 @@ func Emit() bool {
node := innerRingKeys[i]
address := contract.CreateStandardAccount(node.key)
_ = engine.AppCall([]byte(gasHash), "transfer", contractHash, address, gasPerNode)
_ = contract.Call([]byte(gasHash), "transfer", contractHash, address, gasPerNode)
}
runtime.Log("utility token has been emitted to inner ring nodes")
@ -167,7 +166,7 @@ func Vote(epoch int, candidates [][]byte) {
candidate := candidates[index%len(candidates)]
address := runtime.GetExecutingScriptHash()
ok := engine.AppCall([]byte(neoHash), "vote", address, candidate).(bool)
ok := contract.Call([]byte(neoHash), "vote", address, candidate).(bool)
if ok {
runtime.Log(name + ": successfully voted for validator")
removeVotes(ctx, id)

View file

@ -4,7 +4,6 @@ import (
"github.com/nspcc-dev/neo-go/pkg/interop/binary"
"github.com/nspcc-dev/neo-go/pkg/interop/contract"
"github.com/nspcc-dev/neo-go/pkg/interop/crypto"
"github.com/nspcc-dev/neo-go/pkg/interop/engine"
"github.com/nspcc-dev/neo-go/pkg/interop/runtime"
"github.com/nspcc-dev/neo-go/pkg/interop/storage"
"github.com/nspcc-dev/neo-go/pkg/interop/util"
@ -79,18 +78,18 @@ func Neo() int {
}
func balance(hash string, addr []byte) int {
balance := engine.AppCall([]byte(hash), "balanceOf", addr)
balance := contract.Call([]byte(hash), "balanceOf", addr)
return balance.(int)
}
func irList() []irNode {
netmapContractAddr := storage.Get(ctx, netmapContractKey).([]byte)
return engine.AppCall(netmapContractAddr, "innerRingList").([]irNode)
return contract.Call(netmapContractAddr, "innerRingList").([]irNode)
}
func currentEpoch() int {
netmapContractAddr := storage.Get(ctx, netmapContractKey).([]byte)
return engine.AppCall(netmapContractAddr, "epoch").(int)
return contract.Call(netmapContractAddr, "epoch").(int)
}
func checkPermission(ir []irNode) bool {
@ -126,7 +125,7 @@ func Emit() bool {
contractHash := runtime.GetExecutingScriptHash()
neo := balance(neoHash, contractHash)
_ = engine.AppCall([]byte(neoHash), "transfer", contractHash, contractHash, neo)
_ = contract.Call([]byte(neoHash), "transfer", contractHash, contractHash, neo)
gas := balance(gasHash, contractHash)
gasPerNode := gas * 7 / 8 / len(innerRingKeys)
@ -140,7 +139,7 @@ func Emit() bool {
node := innerRingKeys[i]
address := contract.CreateStandardAccount(node.key)
_ = engine.AppCall([]byte(gasHash), "transfer", contractHash, address, gasPerNode)
_ = contract.Call([]byte(gasHash), "transfer", contractHash, address, gasPerNode)
}
runtime.Log("utility token has been emitted to inner ring nodes")
@ -167,7 +166,7 @@ func Vote(epoch int, candidates [][]byte) {
candidate := candidates[index%len(candidates)]
address := runtime.GetExecutingScriptHash()
ok := engine.AppCall([]byte(neoHash), "vote", address, candidate).(bool)
ok := contract.Call([]byte(neoHash), "vote", address, candidate).(bool)
if ok {
runtime.Log(name + ": successfully voted for validator")
removeVotes(ctx, id)

View file

@ -4,7 +4,6 @@ import (
"github.com/nspcc-dev/neo-go/pkg/interop/binary"
"github.com/nspcc-dev/neo-go/pkg/interop/contract"
"github.com/nspcc-dev/neo-go/pkg/interop/crypto"
"github.com/nspcc-dev/neo-go/pkg/interop/engine"
"github.com/nspcc-dev/neo-go/pkg/interop/runtime"
"github.com/nspcc-dev/neo-go/pkg/interop/storage"
"github.com/nspcc-dev/neo-go/pkg/interop/util"
@ -79,18 +78,18 @@ func Neo() int {
}
func balance(hash string, addr []byte) int {
balance := engine.AppCall([]byte(hash), "balanceOf", addr)
balance := contract.Call([]byte(hash), "balanceOf", addr)
return balance.(int)
}
func irList() []irNode {
netmapContractAddr := storage.Get(ctx, netmapContractKey).([]byte)
return engine.AppCall(netmapContractAddr, "innerRingList").([]irNode)
return contract.Call(netmapContractAddr, "innerRingList").([]irNode)
}
func currentEpoch() int {
netmapContractAddr := storage.Get(ctx, netmapContractKey).([]byte)
return engine.AppCall(netmapContractAddr, "epoch").(int)
return contract.Call(netmapContractAddr, "epoch").(int)
}
func checkPermission(ir []irNode) bool {
@ -126,7 +125,7 @@ func Emit() bool {
contractHash := runtime.GetExecutingScriptHash()
neo := balance(neoHash, contractHash)
_ = engine.AppCall([]byte(neoHash), "transfer", contractHash, contractHash, neo)
_ = contract.Call([]byte(neoHash), "transfer", contractHash, contractHash, neo)
gas := balance(gasHash, contractHash)
gasPerNode := gas * 7 / 8 / len(innerRingKeys)
@ -140,7 +139,7 @@ func Emit() bool {
node := innerRingKeys[i]
address := contract.CreateStandardAccount(node.key)
_ = engine.AppCall([]byte(gasHash), "transfer", contractHash, address, gasPerNode)
_ = contract.Call([]byte(gasHash), "transfer", contractHash, address, gasPerNode)
}
runtime.Log("utility token has been emitted to inner ring nodes")
@ -167,7 +166,7 @@ func Vote(epoch int, candidates [][]byte) {
candidate := candidates[index%len(candidates)]
address := runtime.GetExecutingScriptHash()
ok := engine.AppCall([]byte(neoHash), "vote", address, candidate).(bool)
ok := contract.Call([]byte(neoHash), "vote", address, candidate).(bool)
if ok {
runtime.Log(name + ": successfully voted for validator")
removeVotes(ctx, id)

View file

@ -4,7 +4,6 @@ import (
"github.com/nspcc-dev/neo-go/pkg/interop/binary"
"github.com/nspcc-dev/neo-go/pkg/interop/contract"
"github.com/nspcc-dev/neo-go/pkg/interop/crypto"
"github.com/nspcc-dev/neo-go/pkg/interop/engine"
"github.com/nspcc-dev/neo-go/pkg/interop/runtime"
"github.com/nspcc-dev/neo-go/pkg/interop/storage"
"github.com/nspcc-dev/neo-go/pkg/interop/util"
@ -79,18 +78,18 @@ func Neo() int {
}
func balance(hash string, addr []byte) int {
balance := engine.AppCall([]byte(hash), "balanceOf", addr)
balance := contract.Call([]byte(hash), "balanceOf", addr)
return balance.(int)
}
func irList() []irNode {
netmapContractAddr := storage.Get(ctx, netmapContractKey).([]byte)
return engine.AppCall(netmapContractAddr, "innerRingList").([]irNode)
return contract.Call(netmapContractAddr, "innerRingList").([]irNode)
}
func currentEpoch() int {
netmapContractAddr := storage.Get(ctx, netmapContractKey).([]byte)
return engine.AppCall(netmapContractAddr, "epoch").(int)
return contract.Call(netmapContractAddr, "epoch").(int)
}
func checkPermission(ir []irNode) bool {
@ -126,7 +125,7 @@ func Emit() bool {
contractHash := runtime.GetExecutingScriptHash()
neo := balance(neoHash, contractHash)
_ = engine.AppCall([]byte(neoHash), "transfer", contractHash, contractHash, neo)
_ = contract.Call([]byte(neoHash), "transfer", contractHash, contractHash, neo)
gas := balance(gasHash, contractHash)
gasPerNode := gas * 7 / 8 / len(innerRingKeys)
@ -140,7 +139,7 @@ func Emit() bool {
node := innerRingKeys[i]
address := contract.CreateStandardAccount(node.key)
_ = engine.AppCall([]byte(gasHash), "transfer", contractHash, address, gasPerNode)
_ = contract.Call([]byte(gasHash), "transfer", contractHash, address, gasPerNode)
}
runtime.Log("utility token has been emitted to inner ring nodes")
@ -167,7 +166,7 @@ func Vote(epoch int, candidates [][]byte) {
candidate := candidates[index%len(candidates)]
address := runtime.GetExecutingScriptHash()
ok := engine.AppCall([]byte(neoHash), "vote", address, candidate).(bool)
ok := contract.Call([]byte(neoHash), "vote", address, candidate).(bool)
if ok {
runtime.Log(name + ": successfully voted for validator")
removeVotes(ctx, id)

View file

@ -3,7 +3,6 @@ package auditcontract
import (
"github.com/nspcc-dev/neo-go/pkg/interop/binary"
"github.com/nspcc-dev/neo-go/pkg/interop/contract"
"github.com/nspcc-dev/neo-go/pkg/interop/engine"
"github.com/nspcc-dev/neo-go/pkg/interop/runtime"
"github.com/nspcc-dev/neo-go/pkg/interop/storage"
"github.com/nspcc-dev/neo-go/pkg/interop/util"
@ -88,7 +87,7 @@ func Init(addrNetmap, addrBalance, addrContainer []byte) {
func Put(rawAuditResult []byte) bool {
netmapContractAddr := storage.Get(ctx, netmapContractKey).([]byte)
innerRing := engine.AppCall(netmapContractAddr, "innerRingList").([]irNode)
innerRing := contract.Call(netmapContractAddr, "innerRingList").([]irNode)
auditResult, err := newAuditResult(rawAuditResult)
if err {
@ -122,7 +121,7 @@ func Put(rawAuditResult []byte) bool {
containerContract := storage.Get(ctx, containerContractKey).([]byte)
// todo: implement easy way to get owner from the container id
ownerID := engine.AppCall(containerContract, "owner", auditResult.ContainerID).([]byte)
ownerID := contract.Call(containerContract, "owner", auditResult.ContainerID).([]byte)
if len(ownerID) != ownerIDLength {
runtime.Log("put: can't get owner id of the container")
@ -135,7 +134,7 @@ func Put(rawAuditResult []byte) bool {
balanceContract := storage.Get(ctx, balanceContractKey).([]byte)
irScriptHash := contract.CreateStandardAccount(auditResult.InnerRingNode)
tx := engine.AppCall(balanceContract, "transferX",
tx := contract.Call(balanceContract, "transferX",
ownerScriptHash,
irScriptHash,
auditFee,
@ -149,7 +148,7 @@ func Put(rawAuditResult []byte) bool {
node := auditResult.Nodes[i]
nodeScriptHash := contract.CreateStandardAccount(node.Key)
tx := engine.AppCall(balanceContract, "transferX",
tx := contract.Call(balanceContract, "transferX",
ownerScriptHash,
nodeScriptHash,
node.Reward,

View file

@ -3,8 +3,8 @@ package balancecontract
import (
"github.com/nspcc-dev/neo-go/pkg/interop/binary"
"github.com/nspcc-dev/neo-go/pkg/interop/blockchain"
"github.com/nspcc-dev/neo-go/pkg/interop/contract"
"github.com/nspcc-dev/neo-go/pkg/interop/crypto"
"github.com/nspcc-dev/neo-go/pkg/interop/engine"
"github.com/nspcc-dev/neo-go/pkg/interop/iterator"
"github.com/nspcc-dev/neo-go/pkg/interop/runtime"
"github.com/nspcc-dev/neo-go/pkg/interop/storage"
@ -132,7 +132,7 @@ func TransferX(from, to []byte, amount int, details []byte) bool {
)
netmapContractAddr := storage.Get(ctx, netmapContractKey).([]byte)
innerRing := engine.AppCall(netmapContractAddr, "innerRingList").([]irNode)
innerRing := contract.Call(netmapContractAddr, "innerRingList").([]irNode)
threshold := len(innerRing)/3*2 + 1
irKey := innerRingInvoker(innerRing)
@ -168,7 +168,7 @@ func TransferX(from, to []byte, amount int, details []byte) bool {
func Lock(txID, from, to []byte, amount, until int) bool {
netmapContractAddr := storage.Get(ctx, netmapContractKey).([]byte)
innerRing := engine.AppCall(netmapContractAddr, "innerRingList").([]irNode)
innerRing := contract.Call(netmapContractAddr, "innerRingList").([]irNode)
threshold := len(innerRing)/3*2 + 1
irKey := innerRingInvoker(innerRing)
@ -206,7 +206,7 @@ func Lock(txID, from, to []byte, amount, until int) bool {
func NewEpoch(epochNum int) bool {
netmapContractAddr := storage.Get(ctx, netmapContractKey).([]byte)
innerRing := engine.AppCall(netmapContractAddr, "innerRingList").([]irNode)
innerRing := contract.Call(netmapContractAddr, "innerRingList").([]irNode)
threshold := len(innerRing)/3*2 + 1
irKey := innerRingInvoker(innerRing)
@ -245,7 +245,7 @@ func NewEpoch(epochNum int) bool {
func Mint(to []byte, amount int, details []byte) bool {
netmapContractAddr := storage.Get(ctx, netmapContractKey).([]byte)
innerRing := engine.AppCall(netmapContractAddr, "innerRingList").([]irNode)
innerRing := contract.Call(netmapContractAddr, "innerRingList").([]irNode)
threshold := len(innerRing)/3*2 + 1
irKey := innerRingInvoker(innerRing)
@ -276,7 +276,7 @@ func Mint(to []byte, amount int, details []byte) bool {
func Burn(from []byte, amount int, details []byte) bool {
netmapContractAddr := storage.Get(ctx, netmapContractKey).([]byte)
innerRing := engine.AppCall(netmapContractAddr, "innerRingList").([]irNode)
innerRing := contract.Call(netmapContractAddr, "innerRingList").([]irNode)
threshold := len(innerRing)/3*2 + 1
irKey := innerRingInvoker(innerRing)

View file

@ -5,7 +5,6 @@ import (
"github.com/nspcc-dev/neo-go/pkg/interop/blockchain"
"github.com/nspcc-dev/neo-go/pkg/interop/contract"
"github.com/nspcc-dev/neo-go/pkg/interop/crypto"
"github.com/nspcc-dev/neo-go/pkg/interop/engine"
"github.com/nspcc-dev/neo-go/pkg/interop/iterator"
"github.com/nspcc-dev/neo-go/pkg/interop/runtime"
"github.com/nspcc-dev/neo-go/pkg/interop/storage"
@ -78,7 +77,7 @@ func Init(addrNetmap, addrBalance, addrID []byte) {
func Put(container, signature, publicKey []byte) bool {
netmapContractAddr := storage.Get(ctx, netmapContractKey).([]byte)
innerRing := engine.AppCall(netmapContractAddr, "innerRingList").([]irNode)
innerRing := contract.Call(netmapContractAddr, "innerRingList").([]irNode)
threshold := len(innerRing)/3*2 + 1
offset := int(container[1])
@ -94,7 +93,7 @@ func Put(container, signature, publicKey []byte) bool {
// check provided key
if !isSignedByOwnerKey(container, signature, ownerID, publicKey) {
// check keys from NeoFSID
keys := engine.AppCall(neofsIDContractAddr, "key", ownerID).([][]byte)
keys := contract.Call(neofsIDContractAddr, "key", ownerID).([][]byte)
if !verifySignature(container, signature, keys) {
panic("put: invalid owner signature")
}
@ -107,7 +106,7 @@ func Put(container, signature, publicKey []byte) bool {
from := walletToScripHash(ownerID)
balanceContractAddr := storage.Get(ctx, balanceContractKey).([]byte)
containerFee := engine.AppCall(netmapContractAddr, "config", containerFeeKey).(int)
containerFee := contract.Call(netmapContractAddr, "config", containerFeeKey).(int)
hashCandidate := invokeID([]interface{}{container, signature, publicKey}, []byte("put"))
n := vote(ctx, hashCandidate, irKey)
@ -119,7 +118,7 @@ func Put(container, signature, publicKey []byte) bool {
node := innerRing[i]
to := contract.CreateStandardAccount(node.key)
tx := engine.AppCall(balanceContractAddr, "transferX",
tx := contract.Call(balanceContractAddr, "transferX",
from,
to,
containerFee,
@ -133,7 +132,7 @@ func Put(container, signature, publicKey []byte) bool {
addContainer(ctx, containerID, ownerID, container)
// try to remove underscore at v0.92.0
_ = engine.AppCall(neofsIDContractAddr, "addKey", ownerID, [][]byte{publicKey})
_ = contract.Call(neofsIDContractAddr, "addKey", ownerID, [][]byte{publicKey})
runtime.Log("put: added new container")
} else {
@ -145,7 +144,7 @@ func Put(container, signature, publicKey []byte) bool {
func Delete(containerID, signature []byte) bool {
netmapContractAddr := storage.Get(ctx, netmapContractKey).([]byte)
innerRing := engine.AppCall(netmapContractAddr, "innerRingList").([]irNode)
innerRing := contract.Call(netmapContractAddr, "innerRingList").([]irNode)
threshold := len(innerRing)/3*2 + 1
ownerID := getOwnerByID(ctx, containerID)
@ -159,7 +158,7 @@ func Delete(containerID, signature []byte) bool {
if len(irKey) == 0 {
// check provided key
neofsIDContractAddr := storage.Get(ctx, neofsIDContractKey).([]byte)
keys := engine.AppCall(neofsIDContractAddr, "key", ownerID).([][]byte)
keys := contract.Call(neofsIDContractAddr, "key", ownerID).([][]byte)
if !verifySignature(containerID, signature, keys) {
panic("delete: invalid owner signature")
@ -228,7 +227,7 @@ func SetEACL(eACL, signature []byte) bool {
}
neofsIDContractAddr := storage.Get(ctx, neofsIDContractKey).([]byte)
keys := engine.AppCall(neofsIDContractAddr, "key", ownerID).([][]byte)
keys := contract.Call(neofsIDContractAddr, "key", ownerID).([][]byte)
if !verifySignature(eACL, signature, keys) {
panic("setEACL: invalid eACL signature")

View file

@ -36,7 +36,6 @@ import (
"github.com/nspcc-dev/neo-go/pkg/interop/blockchain"
"github.com/nspcc-dev/neo-go/pkg/interop/contract"
"github.com/nspcc-dev/neo-go/pkg/interop/crypto"
"github.com/nspcc-dev/neo-go/pkg/interop/engine"
"github.com/nspcc-dev/neo-go/pkg/interop/iterator"
"github.com/nspcc-dev/neo-go/pkg/interop/runtime"
"github.com/nspcc-dev/neo-go/pkg/interop/storage"
@ -184,7 +183,7 @@ func InnerRingCandidateAdd(key []byte) bool {
to := runtime.GetExecutingScriptHash()
fee := getConfig(ctx, candidateFeeConfigKey).(int)
transferred := engine.AppCall([]byte(tokenHash), "transfer", from, to, fee).(bool)
transferred := contract.Call([]byte(tokenHash), "transfer", from, to, fee).(bool)
if !transferred {
panic("irCandidateAdd: failed to transfer funds, aborting")
}
@ -212,7 +211,7 @@ func Deposit(from []byte, amount int, rcv []byte) bool {
to := runtime.GetExecutingScriptHash()
transferred := engine.AppCall([]byte(tokenHash), "transfer", from, to, amount).(bool)
transferred := contract.Call([]byte(tokenHash), "transfer", from, to, amount).(bool)
if !transferred {
panic("deposit: failed to transfer funds, aborting")
}
@ -278,7 +277,7 @@ func Cheque(id, user []byte, amount int, lockAcc []byte) bool {
from := runtime.GetExecutingScriptHash()
transferred := engine.AppCall([]byte(tokenHash), "transfer", from, user, amount).(bool)
transferred := contract.Call([]byte(tokenHash), "transfer", from, user, amount).(bool)
if !transferred {
panic("cheque: failed to transfer funds, aborting")
}

View file

@ -3,8 +3,8 @@ package neofsidcontract
import (
"github.com/nspcc-dev/neo-go/pkg/interop/binary"
"github.com/nspcc-dev/neo-go/pkg/interop/blockchain"
"github.com/nspcc-dev/neo-go/pkg/interop/contract"
"github.com/nspcc-dev/neo-go/pkg/interop/crypto"
"github.com/nspcc-dev/neo-go/pkg/interop/engine"
"github.com/nspcc-dev/neo-go/pkg/interop/runtime"
"github.com/nspcc-dev/neo-go/pkg/interop/storage"
"github.com/nspcc-dev/neo-go/pkg/interop/util"
@ -74,7 +74,7 @@ func AddKey(owner []byte, keys [][]byte) bool {
}
netmapContractAddr := storage.Get(ctx, netmapContractKey).([]byte)
innerRing := engine.AppCall(netmapContractAddr, "innerRingList").([]irNode)
innerRing := contract.Call(netmapContractAddr, "innerRingList").([]irNode)
threshold := len(innerRing)/3*2 + 1
irKey := innerRingInvoker(innerRing)
@ -128,7 +128,7 @@ func RemoveKey(owner []byte, keys [][]byte) bool {
}
netmapContractAddr := storage.Get(ctx, netmapContractKey).([]byte)
innerRing := engine.AppCall(netmapContractAddr, "innerRingList").([]irNode)
innerRing := contract.Call(netmapContractAddr, "innerRingList").([]irNode)
threshold := len(innerRing)/3*2 + 1
irKey := innerRingInvoker(innerRing)