[#109] alphabet: Do not emit GAS to proxy if notary disabled

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2021-07-21 13:44:59 +03:00 committed by Alex Vanin
parent 4d648431d6
commit a0db77247e

View file

@ -135,6 +135,8 @@ func Emit() {
neo.Transfer(contractHash, contractHash, neo.BalanceOf(contractHash), nil)
gasBalance := gas.BalanceOf(contractHash)
if !notaryDisabled {
proxyAddr := storage.Get(ctx, proxyKey).(interop.Hash160)
proxyGas := gasBalance / 2
@ -143,7 +145,10 @@ func Emit() {
}
gas.Transfer(contractHash, proxyAddr, proxyGas, nil)
gasBalance -= proxyGas
runtime.Log("utility token has been emitted to proxy contract")
}
var innerRing []common.IRNode
@ -154,7 +159,7 @@ func Emit() {
innerRing = common.InnerRingNodes()
}
gasPerNode := gasBalance / 2 * 7 / 8 / len(innerRing)
gasPerNode := gasBalance * 7 / 8 / len(innerRing)
if gasPerNode != 0 {
for _, node := range innerRing {