[#109] alphabet: Do not emit GAS to proxy
if notary disabled
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
4d648431d6
commit
a0db77247e
1 changed files with 13 additions and 8 deletions
|
@ -135,16 +135,21 @@ func Emit() {
|
||||||
neo.Transfer(contractHash, contractHash, neo.BalanceOf(contractHash), nil)
|
neo.Transfer(contractHash, contractHash, neo.BalanceOf(contractHash), nil)
|
||||||
|
|
||||||
gasBalance := gas.BalanceOf(contractHash)
|
gasBalance := gas.BalanceOf(contractHash)
|
||||||
proxyAddr := storage.Get(ctx, proxyKey).(interop.Hash160)
|
|
||||||
|
|
||||||
proxyGas := gasBalance / 2
|
if !notaryDisabled {
|
||||||
if proxyGas == 0 {
|
proxyAddr := storage.Get(ctx, proxyKey).(interop.Hash160)
|
||||||
panic("no gas to emit")
|
|
||||||
|
proxyGas := gasBalance / 2
|
||||||
|
if proxyGas == 0 {
|
||||||
|
panic("no gas to emit")
|
||||||
|
}
|
||||||
|
|
||||||
|
gas.Transfer(contractHash, proxyAddr, proxyGas, nil)
|
||||||
|
gasBalance -= proxyGas
|
||||||
|
|
||||||
|
runtime.Log("utility token has been emitted to proxy contract")
|
||||||
}
|
}
|
||||||
|
|
||||||
gas.Transfer(contractHash, proxyAddr, proxyGas, nil)
|
|
||||||
runtime.Log("utility token has been emitted to proxy contract")
|
|
||||||
|
|
||||||
var innerRing []common.IRNode
|
var innerRing []common.IRNode
|
||||||
|
|
||||||
if notaryDisabled {
|
if notaryDisabled {
|
||||||
|
@ -154,7 +159,7 @@ func Emit() {
|
||||||
innerRing = common.InnerRingNodes()
|
innerRing = common.InnerRingNodes()
|
||||||
}
|
}
|
||||||
|
|
||||||
gasPerNode := gasBalance / 2 * 7 / 8 / len(innerRing)
|
gasPerNode := gasBalance * 7 / 8 / len(innerRing)
|
||||||
|
|
||||||
if gasPerNode != 0 {
|
if gasPerNode != 0 {
|
||||||
for _, node := range innerRing {
|
for _, node := range innerRing {
|
||||||
|
|
Loading…
Reference in a new issue