Skip to content

Commit febd576

Browse files
authored
Merge pull request #922 from ajna-finance/develop
Merge develop in master
2 parents b301603 + 3052ba4 commit febd576

File tree

105 files changed

+5383
-1834
lines changed

Some content is hidden

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

105 files changed

+5383
-1834
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ report/
1616
keystore/
1717
broadcast/
1818
logFile.txt
19+
*.log
1920

2021
# Certora
2122
.certora_internal/

Makefile

+16-8
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,20 @@ test-with-gas-report :; forge test --no-match-test ${TEST_EXCLUDES} -
2424
test-load :; forge test --match-test testLoad --gas-report
2525

2626
# Invariant Tests
27-
test-invariant-all :; forge t --mt invariant --nmc ${CONTRACT_EXCLUDES}
28-
test-invariant-erc20 :; forge t --mt invariant --nmc ${CONTRACT_EXCLUDES} --mc ERC20
29-
test-invariant-erc721 :; forge t --mt invariant --nmc ${CONTRACT_EXCLUDES} --mc ERC721
30-
test-invariant :; forge t --mt ${MT} --nmc RegressionTest
31-
test-invariant-erc20-precision :; ./tests/forge/invariants/test-invariant-erc20-precision.sh
32-
test-invariant-erc721-precision :; ./tests/forge/invariants/test-invariant-erc721-precision.sh
33-
test-invariant-erc20-buckets :; ./tests/forge/invariants/test-invariant-erc20-buckets.sh
34-
test-invariant-erc721-buckets :; ./tests/forge/invariants/test-invariant-erc721-buckets.sh
27+
test-invariant-all :; forge t --mt invariant --nmc ${CONTRACT_EXCLUDES}
28+
test-invariant-erc20 :; forge t --mt invariant --nmc ${CONTRACT_EXCLUDES} --mc ERC20
29+
test-invariant-erc721 :; forge t --mt invariant --nmc ${CONTRACT_EXCLUDES} --mc ERC721
30+
test-invariant-position-erc20 :; forge t --mt invariant --nmc ${CONTRACT_EXCLUDES} --mc ERC20PoolPosition
31+
test-invariant-position-erc721 :; forge t --mt invariant --nmc ${CONTRACT_EXCLUDES} --mc ERC721PoolPosition
32+
test-invariant-rewards-erc20 :; forge t --mt invariant --nmc ${CONTRACT_EXCLUDES} --mc ERC20PoolRewards
33+
test-invariant-rewards-erc721 :; forge t --mt invariant --nmc ${CONTRACT_EXCLUDES} --mc ERC721PoolRewards
34+
test-invariant :; forge t --mt ${MT} --nmc RegressionTest
35+
test-invariant-erc20-precision :; ./tests/forge/invariants/test-invariant-erc20-precision.sh
36+
test-invariant-erc721-precision :; ./tests/forge/invariants/test-invariant-erc721-precision.sh
37+
test-invariant-erc20-buckets :; ./tests/forge/invariants/test-invariant-erc20-buckets.sh
38+
test-invariant-erc721-buckets :; ./tests/forge/invariants/test-invariant-erc721-buckets.sh
39+
test-invariant-position-erc20-precision :; ./tests/forge/invariants/test-invariant-position-erc20-precision.sh
40+
test-invariant-position-erc721-precision :; ./tests/forge/invariants/test-invariant-position-erc721-precision.sh
3541

3642
# Real-world simulation scenarios
3743
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
@@ -48,6 +54,8 @@ test-swap-load-erc20 :; FOUNDRY_INVARIANT_SHRINK_SEQUENCE=false RUST
4854
test-regression-all : test-regression-erc20 test-regression-erc721 test-regression-prototech
4955
test-regression-erc20 :; forge t --mt test_regression --mc ERC20 --nmc "RealWorldRegression|Prototech"
5056
test-regression-erc721 :; forge t --mt test_regression --mc ERC721 --nmc "RealWorldRegression|Prototech"
57+
test-regression-rewards :; forge t --mt test_regression --mc Rewards --nmc "RealWorldRegression|Prototech"
58+
test-regression-position :; forge t --mt test_regression --mc Position --nmc "RealWorldRegression|Prototech"
5159
test-regression-prototech :; forge t --mt test_regression --mc Prototech
5260
test-regression-rw :; forge t --mt test_regression --mc RealWorldRegression
5361
test-regression :; forge t --mt ${MT}

README.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,19 @@ The Ajna protocol is a non-custodial, peer-to-peer, permissionless lending, borr
66
- Fungible tokens (following the [ERC20 token standard](https://eips.ethereum.org/EIPS/eip-20)).
77
- Non-fungible tokens (following the [ERC721 token standard](https://eips.ethereum.org/EIPS/eip-721))
88

9+
## Caveats:
910
### Token limitations
1011
- 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:
1112
- NFT and fungible tokens which charge a fee on transfer.
1213
- Fungible tokens whose balance rebases.
14+
- The following types of tokens are incompatible with Ajna, and countermeasures exist to explicitly prevent creating a pool with such tokens:
1315
- 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.
16+
### Pool limitations
1417
- Borrowers cannot draw debt from a pool in the same block as when the pool was created.
15-
- 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.
16-
18+
- 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.
19+
### Position NFT limitations
20+
- 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.
21+
Ajna positions NFTs should not be purchased from open markets.
1722

1823

1924
## Development
@@ -144,7 +149,7 @@ make analyze
144149
## Licensing
145150
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.
146151

147-
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:
152+
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:
148153
- To facilitate integrations, public-facing interfaces are licensed under `MIT`, as indicated in their SPDX headers.
149154
- 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.
150155
- 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.

0 commit comments

Comments
 (0)