1package position23import (4 "gno.land/r/gnoswap/access/v1"5)67// RegisterInitializer registers a new position implementation version.8// This function is called by each version (v1, v2, etc.) during initialization9// to register their implementation with the proxy system.10//11// The initializer function creates a new instance of the implementation12// using the provided positionStore interface.13//14// Parameters:15// - cur: current realm context; callers use cross(cur) when crossing into this realm16// - initializer: callback that receives the implementation realm context and position store, then returns that version's IPosition implementation17//18// Security: Only contracts within the domain path can register initializers.19// Each package path can only register once to prevent duplicate registrations.20func RegisterInitializer(cur realm, initializer func(_ int, rlm realm, positionStore IPositionStore) IPosition) {21 initializerFunc := func(_ int, rlm realm, domainStore any) any {22 access.AssertIsRlmCurrent(0, rlm)2324 currentPositionStore, ok := domainStore.(IPositionStore)25 if !ok {26 panic("domainStore is not an IPositionStore")27 }2829 return initializer(0, rlm, currentPositionStore)30 }3132 err := versionManager.RegisterInitializer(0, cur, initializerFunc)33 if err != nil {34 panic(err)35 }3637 err = updateImplementation()38 if err != nil {39 panic(err)40 }41}4243// UpgradeImpl switches the active position implementation to a different version.44// This function allows seamless upgrades from one version to another without45// data migration or downtime.46//47// Parameters:48// - cur: current realm context; callers use cross(cur) when crossing into this realm49// - packagePath: fully qualified package path of a previously registered replacement implementation50//51// Security: Only admin or governance can perform upgrades.52// The new implementation must have been previously registered via RegisterInitializer.53func UpgradeImpl(cur realm, packagePath string) {54 // Ensure only admin or governance can perform upgrades55 caller := cur.Previous().Address()56 access.AssertIsAdminOrGovernance(caller)5758 err := versionManager.ChangeImplementation(0, cur, packagePath)59 if err != nil {60 panic(err)61 }6263 err = updateImplementation()64 if err != nil {65 panic(err)66 }67}6869// GetImplementationPackagePath returns the package path of the currently active implementation.70//71// Returns:72// - packagePath: package path of the active implementation73func GetImplementationPackagePath() string {74 return versionManager.GetCurrentPackagePath()75}76CollectFee(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, positionId uint64) (uint64, string, string, string, string, string)
DecreaseLiquidity(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, positionId uint64, liquidityStr string, amount0MinStr string, amount1MinStr string, deadline int64) (uint64, string, string, string, string, string, string)
GetImplementationPackagePath() string
GetPositionFeeGrowthInside0LastX128(positionId uint64) (string, interface {Error func() string})
GetPositionFeeGrowthInside1LastX128(positionId uint64) (string, interface {Error func() string})
GetPositionFeeGrowthInsideLastX128(positionId uint64) (string, string, interface {Error func() string})
GetPositionLiquidity(positionId uint64) (string, interface {Error func() string})
GetPositionOperator(positionId uint64) (string, interface {Error func() string})
GetPositionOwner(positionId uint64) (string, interface {Error func() string})
GetPositionPoolKey(positionId uint64) (string, interface {Error func() string})
GetPositions() *gno.land/p/nt/bptree/rotree/v0.ReadOnlyTree
GetPositionTickLower(positionId uint64) (int32, interface {Error func() string})
GetPositionTicks(positionId uint64) (int32, int32, interface {Error func() string})
GetPositionTickUpper(positionId uint64) (int32, interface {Error func() string})
GetPositionToken0Balance(positionId uint64) (int64, interface {Error func() string})
GetPositionToken1Balance(positionId uint64) (int64, interface {Error func() string})
GetPositionTokenBalances(positionId uint64) (int64, int64, interface {Error func() string})
GetPositionTokensOwed(positionId uint64) (int64, int64, interface {Error func() string})
GetPositionTokensOwed0(positionId uint64) (int64, interface {Error func() string})
GetPositionTokensOwed1(positionId uint64) (int64, interface {Error func() string})
GetUnclaimedFee(positionId uint64) (string, string, interface {Error func() string})
IncreaseLiquidity(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, positionId uint64, amount0DesiredStr string, amount1DesiredStr string, amount0MinStr string, amount1MinStr string, deadline int64) (uint64, string, string, string, string)
IsBurned(positionId uint64) (bool, interface {Error func() string})
IsInRange(positionId uint64) (bool, interface {Error func() string})
Mint(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, token0 string, token1 string, fee uint32, tickLower int32, tickUpper int32, amount0Desired string, amount1Desired string, amount0Min string, amount1Min string, deadline int64, mintTo string, referrer string) (uint64, string, string, string)
NewPosition(poolKey string, tickLower int32, tickUpper int32, liquidity string, feeGrowthInside0LastX128 string, feeGrowthInside1LastX128 string, tokensOwed0 int64, tokensOwed1 int64, burned bool, operator string) *gno.land/r/gnoswap/position.Position
NewPositionStore(kvStore interface {AddAuthorizedCaller func(int, .uverse.realm, .uverse.address, gno.land/p/gnoswap/store/v1.Permission) .uverse.error; Delete func(int, .uverse.realm, string) .uverse.error; Get func(string) (interface {}, .uverse.error); GetAddress func(string) (.uverse.address, .uverse.error); GetAllKeys func() ([]string, .uverse.error); GetAuthorizedCallers func() (map[.uverse.address]gno.land/p/gnoswap/store/v1.Permission, .uverse.error); GetBPTree func(string) (*gno.land/p/nt/bptree/v0.BPTree, .uverse.error); GetBool func(string) (bool, .uverse.error); GetDomainAddress func() .uverse.address; GetInt64 func(string) (int64, .uverse.error); GetString func(string) (string, .uverse.error); GetUint64 func(string) (uint64, .uverse.error); Has func(string) bool; IsWriteAuthorized func(.uverse.address) bool; RemoveAuthorizedCaller func(int, .uverse.realm, .uverse.address) .uverse.error; Set func(int, .uverse.realm, string, interface {}) .uverse.error; UpdateAuthorizedCaller func(int, .uverse.realm, .uverse.address, gno.land/p/gnoswap/store/v1.Permission) .uverse.error}) interface {GetPosition func(uint64) (gno.land/r/gnoswap/position.Position, bool); GetPositionNextID func() uint64; GetPositions func() *gno.land/p/nt/bptree/v0.BPTree; HasPosition func(uint64) bool; HasPositionNextIDStoreKey func() bool; HasPositionsStoreKey func() bool; RemovePosition func(int, .uverse.realm, uint64) .uverse.error; SetPosition func(int, .uverse.realm, uint64, gno.land/r/gnoswap/position.Position) .uverse.error; SetPositionNextID func(int, .uverse.realm, uint64) .uverse.error; SetPositions func(int, .uverse.realm, *gno.land/p/nt/bptree/v0.BPTree) .uverse.error}
NewPositionsTree() *gno.land/p/nt/bptree/v0.BPTree
RegisterInitializer(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, initializer func(int, .uverse.realm, gno.land/r/gnoswap/position.IPositionStore) gno.land/r/gnoswap/position.IPosition)
Render(path string) string
Reposition(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, positionId uint64, tickLower int32, tickUpper int32, amount0DesiredStr string, amount1DesiredStr string, amount0MinStr string, amount1MinStr string, deadline int64) (uint64, string, int32, int32, string, string)
SetPositionOperator(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, positionId uint64, operator string)
UpgradeImpl(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, packagePath string)
Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.
vm/qrender output, sanitized (docs/render-security.md) and displayed in an empty-sandbox iframe — scripts, forms and popups cannot run. Links stay inert in-preview; right-click to open.