← Back to Realms

Realm

Gno.land Mainnet

gno.land/r/gnoswap/order/limit/impl/v1

Overview

Network
gnoland-1
Realm Path
gno.land/r/gnoswap/order/limit/impl/v1
Exported Functions
1
State Entries
37
Source Files
15
Total Package Entries
62

Exported Functions

1 exported function

State

37 state entries

Source Code

FILES
assert.gno
go
1package impl
2
3import (
4	plimit "gno.land/p/gnoswap/order/limit/v1"
5	ufmt "gno.land/p/nt/ufmt/v0"
6	"gno.land/r/gnoswap/access/v1"
7	"gno.land/r/gnoswap/common"
8	"gno.land/r/gnoswap/order/halt"
9	"gno.land/r/gnoswap/order/keeper"
10)
11
12func (l *limitOrderImpl) assertIsCall(_ int, rlm realm) realm {
13	access.AssertIsRlmCurrent(0, rlm)
14	common.AssertIsNotHandleNativeCoin()
15
16	return rlm.Previous()
17}
18
19func (l *limitOrderImpl) assertIsAdminCall(_ int, rlm realm) realm {
20	prev := l.assertIsCall(0, rlm)
21	access.AssertIsAdminOrGovernance(prev.Address())
22
23	return prev
24}
25
26func assertIsOrderOwner(order *plimit.Order, caller address) {
27	if order.Owner() != caller {
28		panic(makeErrorWithDetails(errNotOrderOwner, "order belongs to another caller").Error())
29	}
30}
31
32// Authorization belongs to the proxy target and its immediate caller, not to
33// the implementation or the transaction's origin signer.
34func assertIsAuthorizedKeeper(target string, caller address) {
35	if !keeper.IsAuthorized(target, keeper.SelectorExecuteOrder, caller) {
36		panic(makeErrorWithDetails(errNotKeeper, ufmt.Sprintf("caller(%s)", caller.String())).Error())
37	}
38}
39
40// validateNotHalted reports the first operation halted for Limit orders.
41func validateNotHalted(operations ...string) error {
42	for _, operation := range operations {
43		if halt.IsHalted(halt.TargetLimit, operation) {
44			return makeErrorWithDetails(errHalted, ufmt.Sprintf("operation(%s)", operation))
45		}
46	}
47
48	return nil
49}
50
51func assertIsNotHalted(operations ...string) {
52	if err := validateNotHalted(operations...); err != nil {
53		panic(err.Error())
54	}
55}
56

Raw Package Data

Raw JSON data