[#49] Remove trigger check from contracts

This check was useful when there was a single
entry point in contract. But right now there is
no point in this.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-02-11 19:20:38 +03:00 committed by Alex Vanin
parent 59d11af046
commit a4a9a49a76
8 changed files with 2 additions and 41 deletions

View file

@ -20,15 +20,9 @@ const (
voteKey = "ballots" voteKey = "ballots"
) )
var ( var ctx storage.Context
ctx storage.Context
)
func init() { func init() {
if runtime.GetTrigger() != runtime.Application {
panic("contract has not been called in application node")
}
ctx = storage.GetContext() ctx = storage.GetContext()
} }

View file

@ -43,10 +43,6 @@ const (
var ctx storage.Context var ctx storage.Context
func init() { func init() {
if runtime.GetTrigger() != runtime.Application {
panic("contract has not been called in application node")
}
ctx = storage.GetContext() ctx = storage.GetContext()
} }

View file

@ -59,10 +59,6 @@ func CreateToken() Token {
} }
func init() { func init() {
if runtime.GetTrigger() != runtime.Application {
panic("contract has not been called in application node")
}
ctx = storage.GetContext() ctx = storage.GetContext()
token = CreateToken() token = CreateToken()
} }

View file

@ -56,10 +56,6 @@ var (
) )
func init() { func init() {
if runtime.GetTrigger() != runtime.Application {
panic("contract has not been called in application node")
}
ctx = storage.GetContext() ctx = storage.GetContext()
} }

View file

@ -80,14 +80,7 @@ var (
) )
func init() { func init() {
// The trigger determines whether this smart-contract is being
// run in 'verification' or 'application' mode.
if runtime.GetTrigger() != runtime.Application {
panic("contract has not been called in application node")
}
ctx = storage.GetContext() ctx = storage.GetContext()
} }
// Init set up initial inner ring node keys. // Init set up initial inner ring node keys.

View file

@ -21,15 +21,9 @@ const (
containerContractKey = "containerScriptHash" containerContractKey = "containerScriptHash"
) )
var ( var ctx storage.Context
ctx storage.Context
)
func init() { func init() {
if runtime.GetTrigger() != runtime.Application {
panic("contract has not been called in application node")
}
ctx = storage.GetContext() ctx = storage.GetContext()
} }

View file

@ -52,10 +52,6 @@ var (
) )
func init() { func init() {
if runtime.GetTrigger() != runtime.Application {
panic("contract has not been called in application node")
}
ctx = storage.GetContext() ctx = storage.GetContext()
} }

View file

@ -25,10 +25,6 @@ var (
) )
func init() { func init() {
if runtime.GetTrigger() != runtime.Application {
panic("contract has not been called in application node")
}
ctx = storage.GetContext() ctx = storage.GetContext()
} }