Skip to content

Commit 306c430

Browse files
Merge pull request #100 from curvefi/killable
docs: contracts sunsetting procedure
2 parents ddefa84 + 48567cb commit 306c430

File tree

16 files changed

+126
-19
lines changed

16 files changed

+126
-19
lines changed

.pre-commit-config.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,21 @@ repos:
2525
rev: v0.1.9
2626
hooks:
2727
- id: natrix
28-
args: [lint, curve_stablecoin/lending/, curve_stablecoin/Controller.vy, curve_stablecoin/constants.vy, curve_stablecoin/ControllerView.vy, curve_stablecoin/MintController.vy, -d, NTX1, NTX4, NTX5, NTX2, NTX9, NTX10]
28+
args: [lint, curve_stablecoin/lending/, curve_stablecoin/controller.vy, curve_stablecoin/constants.vy, curve_stablecoin/ControllerView.vy, curve_stablecoin/MintController.vy, -d, NTX1, NTX4, NTX5, NTX2, NTX9, NTX10]
2929

3030
- repo: https://github.com/benber86/mamushi
3131
rev: v0.0.9
3232
hooks:
3333
- id: mamushi
3434
args: [--line-length=100]
3535
files: ^(curve_stablecoin/lending/LendingFactory\.vy|curve_stablecoin/zaps/CreateFromPool\.vy)$ # TODO slowly increase natrix coverage
36+
37+
- repo: local
38+
hooks:
39+
- id: check-kill-docs
40+
name: Check @custom:kill in Vyper devdoc
41+
entry: python scripts/check_kill_docs.py
42+
language: system
43+
files: \.vy$
44+
exclude: ^curve_stablecoin/(testing|price_oracles|zaps)/|^curve_stablecoin/Stableswap\.vy$
45+
require_serial: true

STYLE.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Style Guide
2+
3+
## File Naming Conventions
4+
5+
### Vyper Files
6+
7+
- **CamelCase** (e.g., `LendFactory.vy`, `Controller.vy`): Deployable contracts
8+
- **snake_case** (e.g., `blueprint_registry.vy`, `constants.vy`): Libraries and modules
9+
10+
This naming convention determines whether a file is treated as a compilation target:
11+
12+
| Naming | Type | Example | Requires `@custom:kill` |
13+
|--------|------|---------|------------------------|
14+
| CamelCase | Contract | `LendFactory.vy` | Yes |
15+
| snake_case | Library | `blueprint_registry.vy` | No |
16+
17+
### Python Files
18+
19+
- **snake_case** for all Python files (e.g., `constants.py`, `deployers.py`)
20+
21+
## Contract Documentation
22+
23+
All deployable contracts (CamelCase `.vy` files) must include a `@custom:kill` attribute in their module docstring explaining how to disable or kill the contract:
24+
25+
```vyper
26+
"""
27+
@title My Contract
28+
@author Curve.fi
29+
@custom:kill Describe how to kill/disable this contract
30+
"""
31+
```

curve_stablecoin/AMM.vy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
@title LLAMMA - crvUSD AMM
44
@author Curve.Fi
55
@license Copyright (c) Curve.Fi, 2020-2024 - all rights reserved
6+
@custom:security [email protected]
7+
@custom:kill AMM is controlled by its Controller. Kill the Controller to halt new loans and liquidations.
68
"""
79

810
# Glossary of variables and terms

curve_stablecoin/ControllerView.vy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77
@notice This contract never requires any direct interaction as the
88
main controller contract forwards all relevant calls.
99
@custom:security [email protected]
10+
@custom:kill Stateless contract doesn't need to be killed.
1011
"""
1112

1213
from curve_stablecoin.interfaces import IAMM
1314
from curve_stablecoin.interfaces import IController
1415
from curve_std.interfaces import IERC20
1516

16-
from curve_stablecoin import Controller as core
17+
from curve_stablecoin import controller as core
1718
import curve_stablecoin.lib.liquidation_lib as liq
1819
from curve_stablecoin import constants as c
1920
from snekmate.utils import math

curve_stablecoin/LMCallback.vy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
@author Curve.Fi
55
@license Copyright (c) Curve.Fi, 2020-2023 - all rights reserved
66
@notice LM callback works like a gauge for collateral in LlamaLend/crvUSD AMMs
7+
@custom:security [email protected]
8+
@custom:kill Call set_killed(true) via factory admin to stop CRV emissions
79
"""
810

911
from curve_std.interfaces import IERC20

curve_stablecoin/MintController.vy

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@
22
# pragma nonreentrancy on
33
# pragma optimize codesize
44
"""
5-
@title Mint Controller
5+
@title Llamalend Mint Market Controller
66
@author Curve.Fi
77
@license Copyright (c) Curve.Fi, 2020-2025 - all rights reserved
8-
@notice This is just a simple adapter not to have to deploy a new
8+
@notice Main contract to interact with a Llamalend Mint Market. Each
9+
contract is specific to a single mint market.
10+
@dev This is just a simple adapter not to have to deploy a new
911
factory for mint markets.
1012
@custom:security [email protected]
13+
@custom:kill Set debt_ceiling to 0 via ControllerFactory to prevent new loans. Existing loans can still be repaid/liquidated.
1114
"""
1215

13-
from curve_stablecoin import Controller as core
16+
from curve_stablecoin import controller as core
1417

1518
initializes: core
1619

curve_stablecoin/Controller.vy renamed to curve_stablecoin/controller.vy

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
# pragma version 0.4.3
22
# pragma nonreentrancy on
33
# pragma optimize codesize
4-
"""
5-
@title Llamalend Mint Market Controller
6-
@author Curve.Fi
7-
@license Copyright (c) Curve.Fi, 2020-2025 - all rights reserved
8-
@notice Main contract to interact with a Llamalend Mint Market. Each
9-
contract is specific to a single mint market.
10-
@custom:security [email protected]
11-
"""
124

135
from curve_stablecoin.interfaces import IAMM
146
from curve_stablecoin.interfaces import IMonetaryPolicy

curve_stablecoin/lending/LendController.vy

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
@author Curve.Fi
77
@license Copyright (c) Curve.Fi, 2020-2025 - all rights reserved
88
@notice Main contract to interact with a Llamalend Lend Market. Each
9-
contract is specific to a single mint market.
9+
contract is specific to a single lending market.
1010
@custom:security [email protected]
11+
@custom:kill Set borrow_cap to 0 and vault's max_supply to 0 to prevent new deposits. Existing loans can still be repaid/liquidated.
1112
"""
1213

1314
from curve_std.interfaces import IERC20
@@ -22,7 +23,7 @@ from curve_stablecoin.interfaces import ILendController
2223

2324
implements: ILendController
2425

25-
from curve_stablecoin import Controller as core
26+
from curve_stablecoin import controller as core
2627

2728
from curve_stablecoin.interfaces import IControllerView as IView
2829

curve_stablecoin/lending/LendControllerView.vy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
@license Copyright (c) Curve.Fi, 2020-2025 - all rights reserved
77
@notice This contract never requires any direct interaction as the
88
main controller contract forwards all relevant calls.
9+
@custom:security [email protected]
10+
@custom:kill Stateless contract doesn't need to be killed.
911
"""
1012

1113
from curve_std.interfaces import IERC20

curve_stablecoin/lending/LendFactory.vy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
@author Curve.fi
77
@license Copyright (c) Curve.Fi, 2020-2025 - all rights reserved
88
@custom:security [email protected]
9+
@custom:kill Set blueprints implementations to zero to halt deployments.
910
"""
1011

1112
from curve_std.interfaces import IERC20

0 commit comments

Comments
 (0)