Skip to content

Commit

Permalink
Chore/cleanup (#408)
Browse files Browse the repository at this point in the history
* feat: adds initial account abstraction implementation

* feat: adds the ParaAccount and complete the initial functionality

* feat: a working version with ERC721 verification

* feat: initialize migration

Signed-off-by: GopherJ <[email protected]>

* feat: support different recipient address

Signed-off-by: GopherJ <[email protected]>

* feat: refactor account abstraction to a simple one

* feat: remove not needed contracts

* feat: remove not needed contracts

* chore: adds tests for AA

* chore: adds account address to the accountCreated event

* chore: adds AA deployment step

* chore: adds test for account upgrade

* chore: adds values array to executeBatch

* fix: aa must belong to user

Signed-off-by: GopherJ <[email protected]>

* chore: tiny optimization

Signed-off-by: GopherJ <[email protected]>

* chore: revert unecessary changes

Signed-off-by: GopherJ <[email protected]>

* chore: adds ERC1271 comp

* chore: remove signature encoding for contracts

* chore: replace signature checker.

* fix: hvmtl supplycap

Signed-off-by: GopherJ <[email protected]>

* feat: update admin account

Signed-off-by: GopherJ <[email protected]>

* fix: add missing claimMoonbirds

Signed-off-by: GopherJ <[email protected]>

* chore: update config

Signed-off-by: GopherJ <[email protected]>

* chore: add more aggregators

Signed-off-by: GopherJ <[email protected]>

* chore: add more aggregators

Signed-off-by: GopherJ <[email protected]>

* chore: fixes owner.code

* chore: add missing items

Signed-off-by: GopherJ <[email protected]>

* chore: improve

Signed-off-by: GopherJ <[email protected]>

* chore: catch error

Signed-off-by: GopherJ <[email protected]>

* fix: revert for usdt

Signed-off-by: GopherJ <[email protected]>

* fix: verification

Signed-off-by: GopherJ <[email protected]>

* fix: lint

Signed-off-by: GopherJ <[email protected]>

* chore: revert modification

Signed-off-by: GopherJ <[email protected]>

* fix: typo

Signed-off-by: GopherJ <[email protected]>

* feat: support rescueETH

Signed-off-by: GopherJ <[email protected]>

* fix: partial lint errors

Signed-off-by: GopherJ <[email protected]>

* chore: add migration audit report

Signed-off-by: GopherJ <[email protected]>

* chore: rename

Signed-off-by: GopherJ <[email protected]>

---------

Signed-off-by: GopherJ <[email protected]>
Co-authored-by: 0xwalid <[email protected]>
Co-authored-by: zhoujia6139 <[email protected]>
  • Loading branch information
3 people authored Aug 30, 2023
1 parent 8b3559e commit 73cbb39
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 90 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[![CI](https://github.com/para-space/paraspace-core/workflows/CI/badge.svg)](https://github.com/para-space/paraspace-core/actions)
[![License](https://img.shields.io/github/license/para-space/paraspace-core?color=green)](https://github.com/para-space/paraspace-core/blob/main/LICENSE)

[![Twitter URL](https://img.shields.io/twitter/follow/Paraspace_Official?style=social)](https://twitter.com/paraspace_CM)
[![Twitter URL](https://img.shields.io/twitter/follow/ParaSpace_NFT?style=social)](https://twitter.com/ParaSpace_NFT)
[![Telegram](https://img.shields.io/badge/Telegram-gray?logo=telegram)](https://t.me/parallelfi_community)
[![Medium](https://img.shields.io/badge/Medium-gray?logo=medium)](https://medium.com/@paraspace)
[![Discourse](https://img.shields.io/badge/Forum-gray?logo=discourse)](https://discourse.para.space)
Expand Down
Binary file added audits/SECURE3-V2.pdf
Binary file not shown.
7 changes: 6 additions & 1 deletion contracts/protocol/libraries/logic/PoolLogic.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {ReserveLogic} from "./ReserveLogic.sol";
import {ValidationLogic} from "./ValidationLogic.sol";
import {GenericLogic} from "./GenericLogic.sol";
import {IXTokenType, XTokenType} from "../../../interfaces/IXTokenType.sol";
import {Helpers} from "../../libraries/helpers/Helpers.sol";

/**
* @title PoolLogic library
Expand Down Expand Up @@ -87,7 +88,11 @@ library PoolLogic {
uint256 amountOrTokenId
) external {
if (assetType == DataTypes.AssetType.ERC20) {
IERC20(token).safeTransfer(to, amountOrTokenId);
if (token != address(0)) {
IERC20(token).safeTransfer(to, amountOrTokenId);
} else {
Helpers.safeTransferETH(to, amountOrTokenId);
}
} else if (assetType == DataTypes.AssetType.ERC721) {
IERC721(token).safeTransferFrom(address(this), to, amountOrTokenId);
}
Expand Down
89 changes: 6 additions & 83 deletions helpers/contracts-deployments.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import {MockContract} from "ethereum-waffle";
import {
Account,
AccountFactory,
ACLManager,
AirdropFlashClaimReceiver,
ApeStakingLogic,
Expand Down Expand Up @@ -31,9 +33,9 @@ import {
DelegationRegistry,
DepositContract,
Doodles,
ERC20OracleWrapper,
ERC721Delegate,
ERC721OracleWrapper,
ERC20OracleWrapper,
ExecutionDelegate,
ExecutionManager,
ExecutorWithTimelock,
Expand Down Expand Up @@ -129,6 +131,7 @@ import {
StETHMocked,
StKSMDebtToken,
StrategyStandardSaleForFixedPrice,
SupplyExtendedLogic,
SupplyLogic,
TimeLock,
TransferManagerERC1155,
Expand All @@ -149,86 +152,6 @@ import {
WstETHMocked,
X2Y2Adapter,
X2Y2R1,
X2Y2R1__factory,
AutoCompoundApe,
InitializableAdminUpgradeabilityProxy__factory,
InitializableAdminUpgradeabilityProxy,
ParaProxyInterfaces__factory,
ParaProxyInterfaces,
MockedDelegateRegistry,
MockedDelegateRegistry__factory,
NTokenBAKC,
NTokenBAKC__factory,
P2PPairStaking__factory,
P2PPairStaking,
AirdropFlashClaimReceiver__factory,
AirdropFlashClaimReceiver,
CLwstETHSynchronicityPriceAdapter__factory,
CLExchangeRateSynchronicityPriceAdapter__factory,
CLwstETHSynchronicityPriceAdapter,
WstETHMocked__factory,
WstETHMocked,
BAYCSewerPass__factory,
BAYCSewerPass,
BAYCSewerPassClaim__factory,
AutoYieldApe__factory,
AutoYieldApe,
PYieldToken__factory,
PYieldToken,
UniswapV3TwapOracleWrapper,
UniswapV3TwapOracleWrapper__factory,
HelperContract,
HelperContract__factory,
ParaSpaceAirdrop__factory,
ParaSpaceAirdrop,
CLExchangeRateSynchronicityPriceAdapter,
PTokenAStETH__factory,
PTokenAStETH,
AStETHDebtToken__factory,
AStETHDebtToken,
MockAStETH,
MockAStETH__factory,
MockRETH,
MockRETH__factory,
CLCETHSynchronicityPriceAdapter__factory,
CLCETHSynchronicityPriceAdapter,
MockCToken,
MockCToken__factory,
TimeLock__factory,
DefaultTimeLockStrategy__factory,
DefaultTimeLockStrategy,
NTokenOtherdeed__factory,
NTokenOtherdeed,
HotWalletProxy__factory,
HotWalletProxy,
NTokenStakefish__factory,
NTokenStakefish,
DelegationRegistry,
DelegationRegistry__factory,
StakefishNFTManager__factory,
StakefishNFTManager,
StakefishValidatorV1__factory,
StakefishValidatorV1,
DepositContract__factory,
DepositContract,
StakefishValidatorFactory__factory,
StakefishValidatorFactory,
MockFeePool,
MockFeePool__factory,
MockLendPool__factory,
PoolPositionMover__factory,
PoolPositionMover,
PositionMoverLogic,
PositionMoverLogic__factory,
TimeLock,
NTokenChromieSquiggle__factory,
CLFixedPriceSynchronicityPriceAdapter,
CLFixedPriceSynchronicityPriceAdapter__factory,
Account,
Account__factory,
AccountFactory,
AccountFactory__factory,
SupplyExtendedLogic,
} from "../types";
import {
getACLManager,
Expand Down Expand Up @@ -272,11 +195,11 @@ import {Contract} from "ethers";
import {Address, Libraries} from "hardhat-deploy/dist/types";

import {parseEther} from "ethers/lib/utils";
import fs from "fs";
import {pick, upperFirst} from "lodash";
import shell from "shelljs";
import {ZERO_ADDRESS} from "./constants";
import {GLOBAL_OVERRIDES, ZK_LIBRARIES_PATH} from "./hardhat-constants";
import fs from "fs";
import shell from "shelljs";

export const deployAllLibraries = async (verify?: boolean) => {
const supplyLogic = await deploySupplyLogic(verify);
Expand Down
2 changes: 1 addition & 1 deletion market-config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@ export const MainnetConfig: IParaSpaceConfiguration = {
},
ParaSpaceV1: {
PoolV1: "0x638a98BBB92a7582d07C52ff407D49664DC8b3Ee",
ProtocolDataProviderV1: "0x58A77FcC64eC07798318F62Cb68BC58455f6748A",
ProtocolDataProviderV1: "0xbc88150EbEFDa53fb61F4C59E98d0dE5EBbB8CD3",
CApeV1: "0xC5c9fB6223A989208Df27dCEE33fC59ff5c26fFF",
TimeLockV1: "0x59B72FdB45B3182c8502cC297167FE4f821f332d",
P2PPairStakingV1: "0xf090Eb4c2B63e7B26E8Bb09e6Fc0cC3A7586263B",
Expand Down
2 changes: 0 additions & 2 deletions scripts/deployments/steps/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export const getAllSteps = async () => {
const {step_21} = await import("./21_helperContract");
const {step_22} = await import("./22_timelock");
const {step_23} = await import("./23_renounceOwnership");
const {step_24} = await import("./24_accountAbstraction");

return [
step_00,
Expand All @@ -50,6 +49,5 @@ export const getAllSteps = async () => {
step_21,
step_22,
step_23,
step_24,
];
};
2 changes: 2 additions & 0 deletions scripts/dev/1.ad-hoc.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import rawBRE from "hardhat";

const adHoc = async (verify = false) => {
console.time("ad-hoc");
console.timeEnd("ad-hoc");
};

async function main() {
await rawBRE.run("set-DRE");
await adHoc();
}

Expand Down
4 changes: 2 additions & 2 deletions test/_account_abstraction.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ describe("Account Abstraction", () => {
account.interface.encodeFunctionData("execute", [pool.address, 0, []])
);

builder.useMiddleware((0, Presets.Middleware.EOASignature)(user1.signer));
builder.useMiddleware(Presets.Middleware.EOASignature(user1.signer));
const userOp = await builder.buildOp(
entryPoint.address,
await getChainId()
Expand Down Expand Up @@ -198,7 +198,7 @@ describe("Account Abstraction", () => {
account.interface.encodeFunctionData("execute", [pool.address, 0, []])
);

builder.useMiddleware((0, Presets.Middleware.EOASignature)(user1.signer));
builder.useMiddleware(Presets.Middleware.EOASignature(user1.signer));
const userOp = await builder.buildOp(
entryPoint.address,
await getChainId()
Expand Down

0 comments on commit 73cbb39

Please sign in to comment.