Skip to content

Commit

Permalink
Merge pull request #70 from aave/feat/add-owner-parameter
Browse files Browse the repository at this point in the history
Add owner parameter to support CREATE2 deployments
  • Loading branch information
The-3D authored Mar 4, 2022
2 parents 2123361 + 444139a commit 6d95676
Show file tree
Hide file tree
Showing 10 changed files with 108 additions and 92 deletions.
10 changes: 6 additions & 4 deletions contracts/adapters/paraswap/ParaSwapLiquiditySwapAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ import {ReentrancyGuard} from '../../dependencies/openzeppelin/ReentrancyGuard.s
contract ParaSwapLiquiditySwapAdapter is BaseParaSwapSellAdapter, ReentrancyGuard {
using SafeMath for uint256;

constructor(IPoolAddressesProvider addressesProvider, IParaSwapAugustusRegistry augustusRegistry)
BaseParaSwapSellAdapter(addressesProvider, augustusRegistry)
{
// This is only required to initialize BaseParaSwapSellAdapter
constructor(
IPoolAddressesProvider addressesProvider,
IParaSwapAugustusRegistry augustusRegistry,
address owner
) BaseParaSwapSellAdapter(addressesProvider, augustusRegistry) {
transferOwnership(owner);
}

/**
Expand Down
10 changes: 6 additions & 4 deletions contracts/adapters/paraswap/ParaSwapRepayAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ contract ParaSwapRepayAdapter is BaseParaSwapBuyAdapter, ReentrancyGuard {
bool useEthPath;
}

constructor(IPoolAddressesProvider addressesProvider, IParaSwapAugustusRegistry augustusRegistry)
BaseParaSwapBuyAdapter(addressesProvider, augustusRegistry)
{
// This is only required to initialize BaseParaSwapBuyAdapter
constructor(
IPoolAddressesProvider addressesProvider,
IParaSwapAugustusRegistry augustusRegistry,
address owner
) BaseParaSwapBuyAdapter(addressesProvider, augustusRegistry) {
transferOwnership(owner);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion contracts/misc/WETHGateway.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ contract WETHGateway is IWETHGateway, Ownable {
/**
* @dev Sets the WETH address and the PoolAddressesProvider address. Infinite approves pool.
* @param weth Address of the Wrapped Ether contract
* @param owner Address of the owner of this contract
**/
constructor(address weth) {
constructor(address weth, address owner) {
WETH = IWETH(weth);
transferOwnership(owner);
}

function authorizePool(address pool) external onlyOwner {
Expand Down
106 changes: 49 additions & 57 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aave/periphery-v3",
"version": "1.13.0",
"version": "1.13.1-beta.1",
"description": "Aave Protocol V3 periphery smart contracts",
"files": [
"contracts",
Expand Down Expand Up @@ -32,7 +32,7 @@
},
"license": "AGPLv3",
"devDependencies": {
"@aave/deploy-v3": "^1.19.0",
"@aave/deploy-v3": "^1.21.1-beta.4",
"@ethersproject/abi": "^5.1.0",
"@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers@^0.3.0-beta.11",
"@nomiclabs/hardhat-etherscan": "^2.1.1",
Expand Down Expand Up @@ -88,6 +88,6 @@
"url": "git://github.com/aave/aave-v3-periphery"
},
"dependencies": {
"@aave/core-v3": "^1.14.2"
"@aave/core-v3": "^1.14.3-beta.0"
}
}
2 changes: 1 addition & 1 deletion test/__setup.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { initializeMakeSuite } from './helpers/make-suite';

before(async () => {
if (process.env.EMPTY_RUN === 'true') {
console.log('Skipping due empty test run.')
console.log('Skipping due empty test run.');
return;
}
await hre.deployments.fixture(['market']);
Expand Down
25 changes: 16 additions & 9 deletions test/paraswap/paraswapAdapters.liquiditySwap.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,16 @@ makeSuite('ParaSwap adapters', (testEnv: TestEnv) => {
let evmSnapshotId: string;

before(async () => {
const { addressesProvider } = testEnv;
const { addressesProvider, deployer } = testEnv;

mockAugustus = await new MockParaSwapAugustus__factory(await getFirstSigner()).deploy();
mockAugustusRegistry = await new MockParaSwapAugustusRegistry__factory(
await getFirstSigner()
).deploy(mockAugustus.address);
paraswapLiquiditySwapAdapter = await deployParaSwapLiquiditySwapAdapter(
addressesProvider.address,
mockAugustusRegistry.address
mockAugustusRegistry.address,
deployer.address
);
});

Expand All @@ -58,28 +59,32 @@ makeSuite('ParaSwap adapters', (testEnv: TestEnv) => {
describe('ParaSwapLiquiditySwapAdapter', () => {
describe('constructor', () => {
it('should deploy with correct parameters', async () => {
const { addressesProvider } = testEnv;
const { addressesProvider, deployer } = testEnv;
await deployParaSwapLiquiditySwapAdapter(
addressesProvider.address,
mockAugustusRegistry.address
mockAugustusRegistry.address,
deployer.address
);
});

it('should revert if not valid addresses provider', async () => {
const { deployer } = testEnv;
await expect(
deployParaSwapLiquiditySwapAdapter(
mockAugustus.address, // any invalid contract can be used here
mockAugustusRegistry.address
mockAugustusRegistry.address,
deployer.address
)
).to.be.reverted;
});

it('should revert if not valid augustus registry', async () => {
const { addressesProvider } = testEnv;
const { addressesProvider, deployer } = testEnv;
await expect(
deployParaSwapLiquiditySwapAdapter(
addressesProvider.address,
mockAugustus.address // any invalid contract can be used here
mockAugustus.address, // any invalid contract can be used here
deployer.address
)
).to.be.reverted;
});
Expand Down Expand Up @@ -2677,10 +2682,12 @@ makeSuite('ParaSwap adapters', (testEnv: TestEnv) => {

async function deployParaSwapLiquiditySwapAdapter(
poolAddressesProvider: tEthereumAddress,
augustusRegistry: tEthereumAddress
augustusRegistry: tEthereumAddress,
owner: tEthereumAddress
) {
return await new ParaSwapLiquiditySwapAdapter__factory(await getFirstSigner()).deploy(
poolAddressesProvider,
augustusRegistry
augustusRegistry,
owner
);
}
Loading

0 comments on commit 6d95676

Please sign in to comment.