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

Ape Staking Vault #399

Closed
wants to merge 54 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
d49a005
Flash Claim Receiver Update (#398)
zhoujia6139 Jul 3, 2023
cd61586
chore: basic logic for pair staking
zhoujia6139 Jul 3, 2023
797849d
chore: pair staking test case
zhoujia6139 Jul 5, 2023
e4765ec
chore: bayc + mayc + bakc base logic and test case
zhoujia6139 Jul 6, 2023
7498945
chore: spit logic contact to reduce contract size
zhoujia6139 Jul 7, 2023
e439449
chore: add owner interface
zhoujia6139 Jul 7, 2023
9774dcf
chore: compound fee
zhoujia6139 Jul 7, 2023
ad76019
chore: fix compound fee
zhoujia6139 Jul 8, 2023
dec78f6
chore: refactor and add test case
zhoujia6139 Jul 10, 2023
a47977c
chore: add pending reward interface
zhoujia6139 Jul 10, 2023
ac73a54
chore: add multicall
zhoujia6139 Jul 11, 2023
e8404ca
chore: small optimization
zhoujia6139 Jul 12, 2023
dd4e2bb
chore: fix bakc single pool issue
zhoujia6139 Jul 12, 2023
ee5b36b
chore: gas optimization
zhoujia6139 Jul 12, 2023
610e8ed
chore: refactor and gas optimization
zhoujia6139 Jul 13, 2023
73a73ec
chore: fix p2p logic
zhoujia6139 Jul 13, 2023
91cd6f0
chore: use one-time approve
zhoujia6139 Jul 14, 2023
78cbb45
chore: rename script
zhoujia6139 Jul 14, 2023
ee177cb
chore: add comment and small optimization
zhoujia6139 Jul 14, 2023
8d0c5cb
chore: remove unused storage
zhoujia6139 Jul 17, 2023
2d382b0
chore: vault optimization and fix
zhoujia6139 Jul 18, 2023
7c82970
chore: Ape coin pool
zhoujia6139 Jul 19, 2023
7e8079e
chore: ape coin pool logic implementation
zhoujia6139 Jul 20, 2023
2a50966
chore: add pool ape staking test case.
zhoujia6139 Jul 24, 2023
63e5244
chore: small optimization
zhoujia6139 Jul 24, 2023
82e7a24
chore: add test case and fix lint
zhoujia6139 Jul 24, 2023
08c01a8
chore: remove ApeCoinPoolState
zhoujia6139 Jul 25, 2023
1c5c943
chore: refactor pool state and bakc single pool
zhoujia6139 Jul 25, 2023
f53f163
chore: add pool borrow and stake
zhoujia6139 Jul 27, 2023
4702119
chore: auto claim reward when nToken owner change.
zhoujia6139 Jul 27, 2023
725c7a7
chore: auto claim test case
zhoujia6139 Jul 27, 2023
9924c4c
chore: reduce contract size
zhoujia6139 Jul 28, 2023
4a3dce9
chore: gas optimization
zhoujia6139 Jul 28, 2023
d954418
chore: add time lock for sApe
zhoujia6139 Jul 29, 2023
1e5a776
chore: reduce contract size
zhoujia6139 Jul 31, 2023
31ea327
chore:support ape coin order as sApe balance
zhoujia6139 Aug 1, 2023
5839f00
chore: update constant hash value
zhoujia6139 Aug 1, 2023
86a15f1
chore: ApeCoin Order sApe liquidation
zhoujia6139 Aug 1, 2023
a7dc3ee
chore: small optimization
zhoujia6139 Aug 1, 2023
5843b04
chore: add query interface
zhoujia6139 Aug 2, 2023
4093145
chore: remove burn callback
zhoujia6139 Aug 2, 2023
9810d8b
chore: optimization
zhoujia6139 Aug 2, 2023
2dbac09
chore: fix compound fee.
zhoujia6139 Aug 2, 2023
26ee4df
chore: refactor query and claim pendign reward
zhoujia6139 Aug 2, 2023
6d03eec
chore: update token status query interface
zhoujia6139 Aug 3, 2023
7a4142a
chore: simplify poolTokenStatus
zhoujia6139 Aug 3, 2023
8b85cbc
chore: add comment
zhoujia6139 Aug 3, 2023
c4b0cec
chore: fix review issue and some optimization
zhoujia6139 Aug 4, 2023
67a0f41
feat: add zksync & linea & polygon & polygonZkEVM & moonbeam support …
GopherJ Aug 4, 2023
cbdf4be
chore: unstake user ape staking position when hf < 1
zhoujia6139 Aug 7, 2023
eaf96e2
chore: fix review issue
zhoujia6139 Aug 7, 2023
13516b3
chore: add event definition and remove P2P contract
zhoujia6139 Aug 8, 2023
a784db1
chore: fix lint
zhoujia6139 Aug 8, 2023
940cb09
merge main branch
zhoujia6139 Aug 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"node/no-missing-import": "off",
"no-unpublished-import": "off",
"no-case-declarations": "off",
"@typescript-eslint/no-non-null-assertion": "off"
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-non-null-asserted-optional-chain": "off"
}
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ coverage.json
/coverage
dist

artifacts-zk/
cache-zk/
zk-libraries.json

keystore/

# Setting for non zero-installs (https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored)
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18
18.16.0
53 changes: 33 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,27 @@ init: submodules

.PHONY: test
test:
npx hardhat test ./test/${TEST_TARGET} --network ${NETWORK} # --verbose

npx hardhat test ./test/${TEST_TARGET} --network ${NETWORK} --no-compile
.PHONY: local-test
local-test:
make MOCHA_JOBS=0 DB_PATH=deployed-contracts.json DEPLOY_START=21 NETWORK=localhost test

.PHONY: slow-test
slow-test:
MOCHA_JOBS=0 DB_PATH=deployed-contracts.json npx hardhat test ./test/${TEST_TARGET} --network ${NETWORK} # --verbose
MOCHA_JOBS=0 DB_PATH=deployed-contracts.json npx hardhat test ./test/${TEST_TARGET} --network ${NETWORK} --no-compile

.PHONY: fast-test
fast-test:
MOCHA_JOBS=4 DB_PATH=:memory: npx hardhat test ./test/${TEST_TARGET} --network ${NETWORK} # --verbose
MOCHA_JOBS=4 DB_PATH=:memory: npx hardhat test ./test/${TEST_TARGET} --network ${NETWORK} --no-compile

.PHONY: size
size:
yarn size

.PHONY: build
build: clean
yarn build
yarn build --network ${NETWORK}
yarn typechain

.PHONY: doc
doc:
Expand All @@ -52,7 +52,7 @@ lint:

.PHONY: coverage
coverage:
yarn coverage
yarn coverage --no-compile

.PHONY: format
format:
Expand Down Expand Up @@ -264,9 +264,9 @@ test-ape-staking:
test-auto-compound-ape:
make TEST_TARGET=auto_compound_ape.spec.ts test

.PHONY: test-p2p-pair-staking
test-p2p-pair-staking:
make TEST_TARGET=p2p_pair_staking.spec.ts test
.PHONY: test-para-ape-staking
test-para-aper-staking:
make TEST_TARGET=para_ape_staking.spec.ts test

.PHONY: test-sape-operation
test-sape-operation:
Expand All @@ -286,7 +286,7 @@ test-stakefish-nft:

.PHONY: run
run:
npx hardhat run $(SCRIPT_PATH) --network $(NETWORK)
npx hardhat run $(SCRIPT_PATH) --network $(NETWORK) --no-compile

.PHONY: run-task
run-task:
Expand Down Expand Up @@ -384,9 +384,9 @@ deploy-blur-exchange:
deploy-flashClaimRegistry:
make TASK_NAME=deploy:flash-claim-registry run-task

.PHONY: deploy-p2p-pair-staking
deploy-p2p-pair-staking:
make TASK_NAME=deploy:P2PPairStaking run-task
.PHONY: deploy-para-ape-staking
deploy-para-ape-staking:
make TASK_NAME=deploy:ParaApeStaking run-task

.PHONY: deploy-timelock
deploy-timelock:
Expand All @@ -396,6 +396,10 @@ deploy-timelock:
deploy-renounceOwnership:
make TASK_NAME=deploy:renounce-ownership run-task

.PHONY: deploy-all-libraries
deploy-all-libraries:
make TASK_NAME=deploy:all-libraries run-task

.PHONY: ad-hoc
ad-hoc:
make SCRIPT_PATH=./scripts/dev/1.ad-hoc.ts run
Expand Down Expand Up @@ -444,6 +448,14 @@ set-timelock-strategy:
acl:
make SCRIPT_PATH=./scripts/dev/13.acl.ts run

.PHONY: zksync-bytecode-hashes
zksync-bytecode-hashes:
make SCRIPT_PATH=./scripts/dev/14.zksync-bytecode-hashes.ts run

.PHONY: redeploy-market
redeploy-market:
make SCRIPT_PATH=./scripts/dev/15.redeploy-market.ts run

.PHONY: transfer-tokens
transfer-tokens:
make SCRIPT_PATH=./scripts/dev/2.transfer-tokens.ts run
Expand Down Expand Up @@ -636,9 +648,9 @@ upgrade-auto-compound-ape:
upgrade-timelock:
make TASK_NAME=upgrade:timelock run-task

.PHONY: upgrade-p2p-pair-staking
upgrade-p2p-pair-staking:
make TASK_NAME=upgrade:p2p-pair-staking run-task
.PHONY: upgrade-para-ape-staking
upgrade-para-ape-staking:
make TASK_NAME=upgrade:para-ape-staking run-task

.PHONY: upgrade-ntoken
upgrade-ntoken:
Expand Down Expand Up @@ -671,15 +683,16 @@ hardhat:
.PHONY: anvil
anvil:
anvil \
$(if $(FORK),--fork-url https://eth-$(FORK).alchemyapi.io/v2/$(ALCHEMY_KEY) --no-rate-limit,) \
$(if $(FORK),--chain-id 522,--chain-id 31337) \
--tracing \
$(if $(FORK),--fork-url https://eth-$(FORK).alchemyapi.io/v2/$(ALCHEMY_KEY) --chain-id 522 --no-rate-limit,--chain-id 31337) \
$(if $(FORK_BLOCK_NUMBER),--fork-block-number $(FORK_BLOCK_NUMBER),) \
$(if $(DEPLOYER_MNEMONIC),--mnemonic "${DEPLOYER_MNEMONIC}",--mnemonic "test test test test test test test test test test test junk") \
--host 0.0.0.0 \
--state-interval 60 \
--dump-state state.json \
$(if $(wildcard state.json),--load-state state.json,) \
--disable-block-gas-limit \
--code-size-limit 100000 \
--timeout 9000000

.PHONY: image
image:
Expand All @@ -701,7 +714,7 @@ shutdown:
docker-compose \
down \
--remove-orphans > /dev/null 2>&1 || true
docker volume prune -f
docker volume prune -f || true
sudo rm -fr redis-data || true
sudo rm -fr logs || true
sudo rm -fr state.json || true
Expand Down
2 changes: 1 addition & 1 deletion contracts/apestaking/AutoCompoundApe.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.10;
pragma solidity ^0.8.0;

import "../dependencies/openzeppelin/upgradeability/Initializable.sol";
import "../dependencies/openzeppelin/upgradeability/OwnableUpgradeable.sol";
Expand Down
4 changes: 2 additions & 2 deletions contracts/apestaking/AutoYieldApe.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
pragma solidity ^0.8.0;

import "../dependencies/openzeppelin/upgradeability/Initializable.sol";
import "../dependencies/openzeppelin/upgradeability/ERC20Upgradeable.sol";
Expand All @@ -8,7 +8,7 @@ import "../dependencies/openzeppelin/contracts/IERC20.sol";
import "../dependencies/openzeppelin/contracts/SafeERC20.sol";
import "../dependencies/openzeppelin/contracts/SafeCast.sol";
import "../dependencies/openzeppelin/contracts/Address.sol";
import "../dependencies/univ3/interfaces/ISwapRouter.sol";
import "../dependencies/uniswapv3-periphery/interfaces/ISwapRouter.sol";
import "../dependencies/yoga-labs/ApeCoinStaking.sol";
import "../interfaces/IAutoYieldApe.sol";
import "../interfaces/IYieldInfo.sol";
Expand Down
Loading
Loading