Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typos #146

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The `MarginAccount` class has several attributes, including `account_id`, `balan

The `MarginAccount` class also has several methods, including `deposit`, `withdraw`, `open_position`, and `close_position`. The `deposit` method is used to add funds to the account, while `withdraw` is used to remove funds. The `open_position` method is used to open a new position in the account, while `close_position` is used to close an existing position.

Overall, the `MarginAccount` class is an important component of the marginfi-v2 project, as it provides a way to manage margin accounts for financial trading. Here is an example of how the `MarginAccount` class might be used in the larger project:
Overall, the `MarginAccount` class is an important component of the marginfi-v2 project, as it provides a way to manage margin accounts for financial trading. Here is an example of how the `MarginAccount` class might be used in a larger project:

```
# Create a new margin account
Expand All @@ -31,4 +31,4 @@ account.withdraw(2000)
2. What is the expected input format for the `cost` and `price` parameters?
- It is not specified in the code what the expected input format is for `cost` and `price`. It is recommended to add comments or documentation to clarify this.
3. Are there any potential edge cases or error scenarios that the function does not handle?
- It is not clear from the code if the function handles scenarios where `cost` or `price` are negative or zero. It is recommended to add error handling or documentation to address these scenarios.
- It is not clear from the code if the function handles scenarios where `cost` or `price` are negative or zero. It is recommended to add error handling or documentation to address these scenarios.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

liquidatee is correct

Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ Overall, this script is a useful tool for testing the MarginFi-v2 project and si

3. What actions are being simulated in this script?

This script simulates a user lending USDC, creating a new MarginFi account, depositing SOL, borrowing USDC, triggering bad health by setting SOL asset weights to 0, liquidating a MarginFi account, and handling bad debt through bankruptcy.
This script simulates a user lending USDC, creating a new MarginFi account, depositing SOL, borrowing USDC, triggering bad health by setting SOL asset weights to 0, liquidating a MarginFi account, and handling bad debt through bankruptcy.
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ fn deposit_funds(amount: u64) -> ProgramResult {
}
```

In this example, the deposit_funds function checks if the deposit amount is greater than a maximum allowed amount. If it is, the function returns an error using the DepositAmountTooLarge variant of the LIPError enum. This error can then be handled by the calling code in a consistent way, regardless of where the error occurred in the project.
In this example, the deposit_funds function checks if the deposit amount is greater than the maximum allowed amount. If it is, the function returns an error using the DepositAmountTooLarge variant of the LIPError enum. This error can then be handled by the calling code in a consistent way, regardless of where the error occurred in the project.
## Questions:
1. What is the purpose of the `LIPError` enum?
- The `LIPError` enum is used to define custom error codes for the `marginfi-v2` project.
2. What are the possible error messages that can be returned by this code?
- The possible error messages are "Campaign is not active", "Deposit amount is too large", and "Deposit hasn't matured yet".
3. What is the significance of the `#[error_code]` attribute?
- The `#[error_code]` attribute is used to mark the `LIPError` enum as an error code enum, which allows it to be used with the `anchor_lang` crate's error handling system.
- The `#[error_code]` attribute is used to mark the `LIPError` enum as an error code enum, which allows it to be used with the `anchor_lang` crate's error handling system.
2 changes: 1 addition & 1 deletion programs/liquidity-incentive-program/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Think of a `Campaign` as a marketing campaign:
* the maximum amount of user deposits allowed
* The maximum rewards to be paid out to users (together with the maximum amount of deposits allowed, this calculates the guaranteed fixed yield).

> NOTE: LIP works off of the concept of a _minimum_ guaranteed yield, but depositors may earn higher yield if marginfi's native lender yield for the related asset exceeds the yield guaranteed by the `Campaign`. This is a win-win for depositors.
> NOTE: LIP works off of the concept of a _minimum_ guaranteed yield, but depositors may earn a higher yield if marginfi's native lender yield for the related asset exceeds the yield guaranteed by the `Campaign`. This is a win-win for depositors.

3. As a proof of reward reserves, campaign creators **lock up maximum rewards to be paid out upon campaign creation**, making it easy for campaign depositors to know the source of yield.

Expand Down
2 changes: 1 addition & 1 deletion programs/marginfi/fuzz/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The framework directly invokes the functions that are normally invoked by the on

The framework uses a bump allocator for account storage. All `AccountInfo` objects are referencing data in the bump allocator.

When an instruction is invoked we direct pass in the `AccountInfo` objects referencing allocated state.
When an instruction is invoked we directly pass in the `AccountInfo` objects referencing allocated state.
Before the invoke we also copy to a local cache and revert the state if the instructions fail.

### Actions
Expand Down