Skip to content

Commit fa49fa7

Browse files
committed
Merge branch 'main' into tim/FLO-30-depositLimit
2 parents 524b5be + abe64b3 commit fa49fa7

87 files changed

Lines changed: 2577 additions & 303 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ FlowALP/
179179

180180
- `FungibleToken.Vault`: Standard token operations
181181
- `DeFiActions.Sink/Source`: DeFi protocol composability
182-
- Entitlements: `FlowALPv0.EParticipant`, `FlowALPv0.EPosition`, `FlowALPv0.EGovernance`, `FlowALPv0.ERebalance`
182+
- Entitlements: `FlowALPModels.EParticipant`, `FlowALPModels.EPosition`, `FlowALPModels.EGovernance`, `FlowALPModels.ERebalance`
183183

184184
## 🛠️ Development
185185

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import "FlowALPv0"
2+
import "FlowALPPositionResources"
3+
4+
/// Returns the maximum health for the given position.
5+
///
6+
/// @param positionOwner: The account address that holds the PositionManager
7+
/// @param pid: The position ID
8+
access(all)
9+
fun main(positionOwner: Address, pid: UInt64): UFix64 {
10+
let manager = getAccount(positionOwner).capabilities
11+
.borrow<&FlowALPPositionResources.PositionManager>(FlowALPv0.PositionPublicPath)
12+
?? panic("Could not borrow PositionManager from \(positionOwner) at \(FlowALPv0.PositionPublicPath)")
13+
return manager.borrowPosition(pid: pid).getMaxHealth()
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import "FlowALPv0"
2+
import "FlowALPPositionResources"
3+
4+
/// Returns the minimum health for the given position.
5+
///
6+
/// @param positionOwner: The account address that holds the PositionManager
7+
/// @param pid: The position ID
8+
access(all)
9+
fun main(positionOwner: Address, pid: UInt64): UFix64 {
10+
let manager = getAccount(positionOwner).capabilities
11+
.borrow<&FlowALPPositionResources.PositionManager>(FlowALPv0.PositionPublicPath)
12+
?? panic("Could not borrow PositionManager from \(positionOwner) at \(FlowALPv0.PositionPublicPath)")
13+
return manager.borrowPosition(pid: pid).getMinHealth()
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import "FlowALPv0"
2+
import "FlowALPPositionResources"
3+
4+
/// Returns the target health for the given position.
5+
///
6+
/// @param positionOwner: The account address that holds the PositionManager
7+
/// @param pid: The position ID
8+
access(all)
9+
fun main(positionOwner: Address, pid: UInt64): UFix64 {
10+
let manager = getAccount(positionOwner).capabilities
11+
.borrow<&FlowALPPositionResources.PositionManager>(FlowALPv0.PositionPublicPath)
12+
?? panic("Could not borrow PositionManager from \(positionOwner) at \(FlowALPv0.PositionPublicPath)")
13+
return manager.borrowPosition(pid: pid).getTargetHealth()
14+
}

cadence/tests/adversarial_recursive_withdraw_source_test.cdc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ fun testRecursiveWithdrawSource() {
120120
// In this test, the topUpSource behavior is adversarial: it attempts to re-enter
121121
// the pool during the pull/deposit flow. We expect the transaction to fail.
122122
let withdrawRes = executeTransaction(
123-
"./transactions/flow-alp/pool-management/withdraw_from_position.cdc",
123+
"./transactions/flow-alp/epositionadmin/withdraw_from_position.cdc",
124124
[positionID, flowTokenIdentifier, 1500.0, true], // pullFromTopUpSource: true
125125
userAccount
126126
)

cadence/tests/adversarial_type_spoofing_test.cdc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ fun testMaliciousSource() {
5959

6060
// withdraw 1337 Flow from the position
6161
let withdrawRes = executeTransaction(
62-
"./transactions/flow-alp/pool-management/withdraw_from_position.cdc",
62+
"./transactions/flow-alp/epositionadmin/withdraw_from_position.cdc",
6363
[1 as UInt64, flowTokenIdentifier, 1337.0, true],
6464
hackerAccount
6565
)

cadence/tests/async_update_position_test.cdc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ fun testUpdatePosition() {
4141
depositToPosition(signer: user, positionID: 0, amount: 600.0, vaultStoragePath: FLOW_VAULT_STORAGE_PATH, pushToDrawDownSink: false)
4242

4343
let updatePositionRes = _executeTransaction(
44-
"./transactions/flow-alp/pool-management/async_update_position.cdc",
44+
"./transactions/flow-alp/eimplementation/async_update_position.cdc",
4545
[ 0 as UInt64 ],
4646
PROTOCOL_ACCOUNT
4747
)

0 commit comments

Comments
 (0)