Skip to content

Commit

Permalink
Merge pull request #922 from ajna-finance/develop
Browse files Browse the repository at this point in the history
Merge develop in master
  • Loading branch information
grandizzy authored Jul 4, 2023
2 parents b301603 + 3052ba4 commit febd576
Show file tree
Hide file tree
Showing 105 changed files with 5,383 additions and 1,834 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ report/
keystore/
broadcast/
logFile.txt
*.log

# Certora
.certora_internal/
Expand Down
24 changes: 16 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,20 @@ test-with-gas-report :; forge test --no-match-test ${TEST_EXCLUDES} -
test-load :; forge test --match-test testLoad --gas-report

# Invariant Tests
test-invariant-all :; forge t --mt invariant --nmc ${CONTRACT_EXCLUDES}
test-invariant-erc20 :; forge t --mt invariant --nmc ${CONTRACT_EXCLUDES} --mc ERC20
test-invariant-erc721 :; forge t --mt invariant --nmc ${CONTRACT_EXCLUDES} --mc ERC721
test-invariant :; forge t --mt ${MT} --nmc RegressionTest
test-invariant-erc20-precision :; ./tests/forge/invariants/test-invariant-erc20-precision.sh
test-invariant-erc721-precision :; ./tests/forge/invariants/test-invariant-erc721-precision.sh
test-invariant-erc20-buckets :; ./tests/forge/invariants/test-invariant-erc20-buckets.sh
test-invariant-erc721-buckets :; ./tests/forge/invariants/test-invariant-erc721-buckets.sh
test-invariant-all :; forge t --mt invariant --nmc ${CONTRACT_EXCLUDES}
test-invariant-erc20 :; forge t --mt invariant --nmc ${CONTRACT_EXCLUDES} --mc ERC20
test-invariant-erc721 :; forge t --mt invariant --nmc ${CONTRACT_EXCLUDES} --mc ERC721
test-invariant-position-erc20 :; forge t --mt invariant --nmc ${CONTRACT_EXCLUDES} --mc ERC20PoolPosition
test-invariant-position-erc721 :; forge t --mt invariant --nmc ${CONTRACT_EXCLUDES} --mc ERC721PoolPosition
test-invariant-rewards-erc20 :; forge t --mt invariant --nmc ${CONTRACT_EXCLUDES} --mc ERC20PoolRewards
test-invariant-rewards-erc721 :; forge t --mt invariant --nmc ${CONTRACT_EXCLUDES} --mc ERC721PoolRewards
test-invariant :; forge t --mt ${MT} --nmc RegressionTest
test-invariant-erc20-precision :; ./tests/forge/invariants/test-invariant-erc20-precision.sh
test-invariant-erc721-precision :; ./tests/forge/invariants/test-invariant-erc721-precision.sh
test-invariant-erc20-buckets :; ./tests/forge/invariants/test-invariant-erc20-buckets.sh
test-invariant-erc721-buckets :; ./tests/forge/invariants/test-invariant-erc721-buckets.sh
test-invariant-position-erc20-precision :; ./tests/forge/invariants/test-invariant-position-erc20-precision.sh
test-invariant-position-erc721-precision :; ./tests/forge/invariants/test-invariant-position-erc721-precision.sh

# Real-world simulation scenarios
test-rw-simulation-erc20 :; FOUNDRY_INVARIANT_SHRINK_SEQUENCE=false RUST_LOG=forge=info,foundry_evm=info,ethers=info forge t --mt invariant_all_erc20 --mc RealWorldScenario
Expand All @@ -48,6 +54,8 @@ test-swap-load-erc20 :; FOUNDRY_INVARIANT_SHRINK_SEQUENCE=false RUST
test-regression-all : test-regression-erc20 test-regression-erc721 test-regression-prototech
test-regression-erc20 :; forge t --mt test_regression --mc ERC20 --nmc "RealWorldRegression|Prototech"
test-regression-erc721 :; forge t --mt test_regression --mc ERC721 --nmc "RealWorldRegression|Prototech"
test-regression-rewards :; forge t --mt test_regression --mc Rewards --nmc "RealWorldRegression|Prototech"
test-regression-position :; forge t --mt test_regression --mc Position --nmc "RealWorldRegression|Prototech"
test-regression-prototech :; forge t --mt test_regression --mc Prototech
test-regression-rw :; forge t --mt test_regression --mc RealWorldRegression
test-regression :; forge t --mt ${MT}
Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,19 @@ The Ajna protocol is a non-custodial, peer-to-peer, permissionless lending, borr
- Fungible tokens (following the [ERC20 token standard](https://eips.ethereum.org/EIPS/eip-20)).
- Non-fungible tokens (following the [ERC721 token standard](https://eips.ethereum.org/EIPS/eip-721))

## Caveats:
### Token limitations
- The following types of tokens are incompatible with Ajna, and no countermeasures exist to explicitly prevent creating a pool with such tokens, actors should use them at their own risk:
- NFT and fungible tokens which charge a fee on transfer.
- Fungible tokens whose balance rebases.
- The following types of tokens are incompatible with Ajna, and countermeasures exist to explicitly prevent creating a pool with such tokens:
- Fungible tokens with more than 18 decimals or 0 decimals, whose `decimals()` function does not return a constant value, or which do not implement the optional [decimals()](https://eips.ethereum.org/EIPS/eip-20#decimals) function.
### Pool limitations
- Borrowers cannot draw debt from a pool in the same block as when the pool was created.
- With the exception of quantized prices, pool inputs and most accumulators are not explicitly limited. The pool will stop functioning when the bounds of a `uint256` need to be exceeded to process a request.

- With the exception of quantized prices, pool inputs and most accumulators are not explicitly limited. The pool will stop functioning when the bounds of a `uint256` need to be exceeded to process a request.
### Position NFT limitations
- Position NFTs are vulnerable to front running attacks when buying from open markets. Seller of such NFT could redeem positions before transfer, and then transfer an NFT without any value to the buyer.
Ajna positions NFTs should not be purchased from open markets.


## Development
Expand Down Expand Up @@ -144,7 +149,7 @@ make analyze
## Licensing
For purposes of the Business Service License: (i) the term “Licensor” means Ajna Labs, LLC, (ii) the term Licensed Work means Licensor’s proprietary software marketed under the name _The Ajna Protocol™_ and useful for purposes of facilitating the lending and borrowing of digital assets, (iii) the term “Additional Use Grants” means a grant of rights in the Licensed Work that are not included in the Business Service License and are granted by Licensor pursuant to a separate agreement between Licensor and one or more third parties, and (iv) the term “Change Date” means April 1, 2026 or such other date as Licensor may specify on or before April 1, 2026.

The licnesed work is under the [Business Service License](https://github.com/ajna-finance/contracts/blob/develop/LICENSE) ("BUSL license") with but not limited to the following exceptions:
The licensed work is under the [Business Service License](https://github.com/ajna-finance/contracts/blob/develop/LICENSE) ("BUSL license") with but not limited to the following exceptions:
- To facilitate integrations, public-facing interfaces are licensed under `MIT`, as indicated in their SPDX headers.
- As a derivative work of [ds-math](https://github.com/dapphub/ds-math/), `Maths.sol` is licensed under `GPL-3.0-or-later`, as indicated in its SPDX header.
- As a derivative work of [SafeERC20Namer](https://github.com/Uniswap/solidity-lib/blob/master/contracts/libraries/SafeERC20Namer.sol), `SafeTokenNamer.sol` is licensed under `GPL-3.0-or-later`, as indicated in its SPDX header.
Expand Down
Loading

0 comments on commit febd576

Please sign in to comment.