[#25] container: Use interop.Hash160 for contract addresses

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-03-17 16:54:55 +03:00 committed by Alex Vanin
parent 2ef8c55562
commit 44cb7ccfd8

View file

@ -112,8 +112,8 @@ func Put(container []byte, signature interop.Signature, publicKey interop.Public
} }
from := walletToScriptHash(ownerID) from := walletToScriptHash(ownerID)
netmapContractAddr := storage.Get(ctx, netmapContractKey).([]byte) netmapContractAddr := storage.Get(ctx, netmapContractKey).(interop.Hash160)
balanceContractAddr := storage.Get(ctx, balanceContractKey).([]byte) balanceContractAddr := storage.Get(ctx, balanceContractKey).(interop.Hash160)
containerFee := contract.Call(netmapContractAddr, "config", contract.ReadOnly, containerFeeKey).(int) containerFee := contract.Call(netmapContractAddr, "config", contract.ReadOnly, containerFeeKey).(int)
// todo: check if new container with unique container id // todo: check if new container with unique container id
@ -154,7 +154,7 @@ func Delete(containerID, signature []byte) bool {
multiaddr := common.InnerRingMultiAddressViaStorage(ctx, netmapContractKey) multiaddr := common.InnerRingMultiAddressViaStorage(ctx, netmapContractKey)
if !runtime.CheckWitness(multiaddr) { if !runtime.CheckWitness(multiaddr) {
// check provided key // check provided key
neofsIDContractAddr := storage.Get(ctx, neofsIDContractKey).([]byte) neofsIDContractAddr := storage.Get(ctx, neofsIDContractKey).(interop.Hash160)
keys := contract.Call(neofsIDContractAddr, "key", contract.ReadOnly, ownerID).([]interop.PublicKey) keys := contract.Call(neofsIDContractAddr, "key", contract.ReadOnly, ownerID).([]interop.PublicKey)
if !verifySignature(containerID, signature, keys) { if !verifySignature(containerID, signature, keys) {