Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ride/factory_v2.ride
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ let wavesString = "WAVES"
let decimalsMultPrice = 100 * 1000 * 1000 # 10^8
let SEP = "__"
let EMPTY = ""
let PoolActive = 1 # ACTIVE, pool without restrictions
let PoolPutDisabled = 2 # PUT DISABLED, pool with put operation disabled
let PoolMatcherDisabled = 3 # MATCHER DISABLED, pool with matcher operations disabled
let PoolShutdown = 4 # SHUTDOWN, pool operations halted
let PoolActive = 1 # ACTIVE, pool without restrictions
let PoolPutDisabled = 2 # PUT DISABLED, pool with put operation disabled
let PoolPutAndMatcherDisabled = 3 # PUT AND MATCHER DISABLED, pool with put and matcher operations disabled
let PoolShutdown = 4 # SHUTDOWN, pool operations halted

let idxInternalAssetId = 1
let idxResutActions = 2
Expand Down
28 changes: 21 additions & 7 deletions ride/lp.ride
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ let big2 = 2.toBigInt()
let wavesString = "WAVES"

let SEP = "__"
let PoolActive = 1 # ACTIVE, pool without restrictions
let PoolPutDisabled = 2 # PUT DISABLED, pool with put operation disabled
let PoolMatcherDisabled = 3 # MATCHER DISABLED, pool with matcher operations disabled
let PoolShutdown = 4 # SHUTDOWN, pool operations halted
let PoolActive = 1 # ACTIVE, pool without restrictions
let PoolPutDisabled = 2 # PUT DISABLED, pool with put operation disabled
let PoolPutAndMatcherDisabled = 3 # PUT AND MATCHER DISABLED, pool with put and matcher operations disabled
let PoolShutdown = 4 # SHUTDOWN, pool operations halted
# data indexes from pool config stored in factory
let idxPoolAddress = 1
let idxPoolStatus = 2
Expand Down Expand Up @@ -686,7 +686,11 @@ func validateMatcherOrderAllowed(order: Order) = {
}

# validate status
if (isGlobalShutdown() || cfgPoolStatus == PoolMatcherDisabled || cfgPoolStatus == PoolShutdown) then throw("Exchange operations disabled") else
if (
isGlobalShutdown() ||
cfgPoolStatus == PoolPutAndMatcherDisabled ||
cfgPoolStatus == PoolShutdown
) then throw("Exchange operations disabled") else

# validate pairs
if (order.assetPair.amountAsset != cfgAmountAssetId || order.assetPair.priceAsset != cfgPriceAssetId) then throw("Wrong order assets.") else
Expand Down Expand Up @@ -752,7 +756,12 @@ func commonPut(i: Invocation, slippageTolerance: Int, emitLp: Boolean) = {
emitLp)

let poolStatus = estPut._8.parseIntValue()
if(isGlobalShutdown() || poolStatus == PoolPutDisabled || poolStatus == PoolShutdown) then throw("Put operation is blocked by admin. Status = " + poolStatus.toString()) else
if(
isGlobalShutdown() ||
poolStatus == PoolPutDisabled ||
poolStatus == PoolPutAndMatcherDisabled ||
poolStatus == PoolShutdown
) then throw("Put operation is blocked by admin. Status = " + poolStatus.toString()) else

estPut
}
Expand Down Expand Up @@ -1133,7 +1142,12 @@ func putOneTkn(minOutAmount: Int, autoStake: Boolean) = {
[this.toString()],
[]
).exactAs[Boolean]
let isPutDisabled = isGlobalShutdown() || cfgPoolStatus == PoolPutDisabled || cfgPoolStatus == PoolShutdown || isPoolOneTokenOperationsDisabled
let isPutDisabled =
isGlobalShutdown() ||
cfgPoolStatus == PoolPutDisabled ||
cfgPoolStatus == PoolPutAndMatcherDisabled ||
cfgPoolStatus == PoolShutdown ||
isPoolOneTokenOperationsDisabled

strict checks = [
!isPutDisabled || i.isManager() || "put operation is blocked by admin".throwErr(),
Expand Down
18 changes: 14 additions & 4 deletions ride/lp_stable.ride
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ let SEP = "__"
let EMPTY = ""
let PoolActive = 1 # ACTIVE, pool without restrictions
let PoolPutDis = 2 # PUT DISABLED, pool with put operation disabled
let PoolMatcherDis = 3 # MATCHER DISABLED, pool with matcher operations disabled
let PoolPutAndMatcherDis = 3 # MATCHER DISABLED, pool with put and matcher operations disabled
let PoolShutdown = 4 # SHUTDOWN, pool operations halted
# data indexes from pool config stored in factory
let idxPoolAddress = 1
Expand Down Expand Up @@ -672,7 +672,7 @@ func validateMatcherOrderAllowed(order: Order) = {
}

# validate status
if (igs() || cfgPoolStatus == PoolMatcherDis || cfgPoolStatus == PoolShutdown) then throw("Admin blocked") else
if (igs() || cfgPoolStatus == PoolPutAndMatcherDis || cfgPoolStatus == PoolShutdown) then throw("Admin blocked") else

# validate pairs
if (order.assetPair.amountAsset != cfgAmountAssetId || order.assetPair.priceAsset != cfgPriceAssetId) then throw("Wr assets") else
Expand Down Expand Up @@ -745,7 +745,12 @@ func cp(caller: String,
pmtId)

let sts = r._8.parseIntValue()
if(igs() || sts == PoolPutDis || sts == PoolShutdown) then throw("Blocked:" + sts.toString()) else
if(
igs() ||
sts == PoolPutDis ||
sts == PoolPutAndMatcherDis ||
sts == PoolShutdown
) then throw("Blocked:" + sts.toString()) else
r
}

Expand Down Expand Up @@ -1171,7 +1176,12 @@ func putOneTknV2(minOutAmount: Int, autoStake: Boolean) = {
[this.toString()],
[]
).exactAs[Boolean]
let isPutDisabled = igs() || cfgPoolStatus == PoolPutDis || cfgPoolStatus == PoolShutdown || isPoolOneTokenOperationsDisabled
let isPutDisabled =
igs() ||
cfgPoolStatus == PoolPutDis ||
cfgPoolStatus == PoolPutAndMatcherDis ||
cfgPoolStatus == PoolShutdown ||
isPoolOneTokenOperationsDisabled

strict checks = [
!isPutDisabled || i.isManager() || "put operation is blocked by admin".throwErr(),
Expand Down