[#105] processing: Add docs
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
726e7995fc
commit
c5ac475d32
2 changed files with 27 additions and 1 deletions
|
@ -1,2 +1,22 @@
|
|||
// Processing contract description.
|
||||
/*
|
||||
Processing contract is a contract deployed in NeoFS main chain.
|
||||
|
||||
Processing contract pays for all multi signature transaction executions when notary
|
||||
service enabled in main chain. Notary service prepares multi signed transaction,
|
||||
however they should contain side chain GAS to be executed. It is inconvenient to
|
||||
ask Alphabet nodes to pay for these transactions: nodes can change over time,
|
||||
some nodes will spend side chain GAS faster, it creates economic instability.
|
||||
|
||||
Processing contract exists to solve this issue. At the Withdraw invocation of
|
||||
NeoFS contract, user pays fee directly to this contract. This fee is used to
|
||||
pay for Cheque invocation of NeoFS contract that returns main chain GAS back
|
||||
to the user. Address of the Processing contract is uses as the first signer in
|
||||
the multi signature transaction. Therefore NeoVM executes Verify method of the
|
||||
contract and if invocation is verified, then Processing contract pays for the
|
||||
execution.
|
||||
|
||||
Contract notifications
|
||||
|
||||
Processing contract does not produce notifications to process.
|
||||
*/
|
||||
package processing
|
||||
|
|
|
@ -18,6 +18,7 @@ const (
|
|||
multiaddrMethod = "alphabetAddress"
|
||||
)
|
||||
|
||||
// OnNEP17Payment is a callback for NEP-17 compatible native GAS contract.
|
||||
func OnNEP17Payment(from interop.Hash160, amount int, data interface{}) {
|
||||
caller := runtime.GetCallingScriptHash()
|
||||
if !common.BytesEqual(caller, []byte(gas.Hash)) {
|
||||
|
@ -50,6 +51,8 @@ func _deploy(data interface{}, isUpdate bool) {
|
|||
runtime.Log("processing contract initialized")
|
||||
}
|
||||
|
||||
// Migrate method updates contract source code and manifest. Can be invoked
|
||||
// only by contract owner.
|
||||
func Migrate(script []byte, manifest []byte, data interface{}) bool {
|
||||
ctx := storage.GetReadOnlyContext()
|
||||
|
||||
|
@ -64,6 +67,8 @@ func Migrate(script []byte, manifest []byte, data interface{}) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
// Verify method returns true if transaction contains valid multi signature of
|
||||
// Alphabet nodes of the Inner Ring.
|
||||
func Verify() bool {
|
||||
ctx := storage.GetContext()
|
||||
neofsContractAddr := storage.Get(ctx, neofsContractKey).(interop.Hash160)
|
||||
|
@ -72,6 +77,7 @@ func Verify() bool {
|
|||
return runtime.CheckWitness(multiaddr)
|
||||
}
|
||||
|
||||
// Version returns version of the contract.
|
||||
func Version() int {
|
||||
return version
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue