Skip to content

Commit

Permalink
Merge pull request #557 from mjavason/feat-add-kSTRK-for-constant
Browse files Browse the repository at this point in the history
Feat add kSTRK for constant
  • Loading branch information
djeck1432 authored Feb 11, 2025
2 parents 95ba803 + d95e061 commit 42da25b
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 5 deletions.
15 changes: 10 additions & 5 deletions web_app/contract_tools/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
MULTIPLIER_POWER = 99
ETH = "ETH"
STRK = "STRK"
kSTRK = "kSTRK"
USDC = "USDC"

ZKLEND_SCALE_DECIMALS = Decimal("1000000000000000000000000000")


@dataclass(frozen=True)
class TokenConfig:
"""
Expand All @@ -34,7 +34,6 @@ class TokenConfig:
collateral_factor: Decimal = Decimal("0.0")
borrow_factor: Decimal = Decimal("0.0")


@dataclass(frozen=True)
class TokenMultipliers:
"""
Expand All @@ -43,9 +42,9 @@ class TokenMultipliers:

ETH: float = 4.6
STRK: float = 1.9
kSTRK: float = 1.8
USDC: float = 5.0


class TokenParams:
"""
Class to hold the token configurations for tokens as class-level variables.
Expand All @@ -65,6 +64,13 @@ class TokenParams:
collateral_factor=Decimal("0.60"),
borrow_factor=Decimal("1"),
)
kSTRK = TokenConfig(
name=kSTRK,
address="0x45cd05ee2caaac3459b87e5e2480099d201be2f62243f839f00e10dde7f500c",
decimals=Decimal("18"),
collateral_factor=Decimal("0.60"),
borrow_factor=Decimal("1"),
)
USDC = TokenConfig(
name=USDC,
address="0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8",
Expand All @@ -78,7 +84,7 @@ def tokens(cls) -> Iterator[TokenConfig]:
"""
Return an iterator over all token configurations.
"""
return iter([cls.ETH, cls.STRK, cls.USDC])
return iter([cls.ETH, cls.STRK, cls.USDC, cls.kSTRK])

@classmethod
def get_token_address(cls, token_name: str) -> str:
Expand Down Expand Up @@ -158,7 +164,6 @@ def add_underlying_address(token_address: str) -> str:
"""
return token_address[:2] + "0" + token_address[2:]


class ProtocolAddress(Enum):
"""
Enum for the protocol addresses.
Expand Down
26 changes: 26 additions & 0 deletions web_app/tests/test_positions.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,32 @@ async def test_get_repay_data_missing_wallet_id(
"ekubo_limits": {"mock_key": "mock_value"},
},
),
# New test case for kSTRK
(
"valid_wallet_id_4",
"kSTRK",
"800",
4,
{
"contract_address": "mock_contract_address",
"position_id": "123",
"pool_price": 100,
"pool_key": {
"token0": "mock_token0",
"token1": "mock_token1",
"fee": "mock_fee",
"tick_spacing": "mock_tick_spacing",
"extension": "mock_extension",
},
"deposit_data": {
"token": "mock_token",
"amount": "mock_amount",
"multiplier": "1",
"borrow_portion_percent": 0,
},
"ekubo_limits": {"mock_key": "mock_value"},
},
),
],
)
@pytest.mark.anyio
Expand Down

0 comments on commit 42da25b

Please sign in to comment.