mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Added new StringLib library with concat to reuse function in deployment helpers.
This commit is contained in:
parent
1ef1f614bd
commit
a966d9f53f
|
@ -10,6 +10,7 @@ import {
|
|||
DefaultReserveInterestRateStrategy
|
||||
} from '../lendingpool/DefaultReserveInterestRateStrategy.sol';
|
||||
import {Ownable} from '../dependencies/openzeppelin/contracts/Ownable.sol';
|
||||
import {StringLib} from '../libraries/helpers/StringLib.sol';
|
||||
|
||||
contract ATokensAndRatesHelper is Ownable {
|
||||
address payable private pool;
|
||||
|
@ -27,10 +28,6 @@ contract ATokensAndRatesHelper is Ownable {
|
|||
poolConfigurator = _poolConfigurator;
|
||||
}
|
||||
|
||||
function concat(string memory a, string memory b) internal pure returns (string memory) {
|
||||
return string(abi.encodePacked(a, b));
|
||||
}
|
||||
|
||||
function initDeployment(
|
||||
address[] calldata tokens,
|
||||
string[] calldata symbols,
|
||||
|
@ -47,8 +44,8 @@ contract ATokensAndRatesHelper is Ownable {
|
|||
LendingPool(pool),
|
||||
tokens[i],
|
||||
address(0),
|
||||
concat('Aave interest bearing ', symbols[i]),
|
||||
concat('a', symbols[i]),
|
||||
StringLib.concat('Aave interest bearing ', symbols[i]),
|
||||
StringLib.concat('a', symbols[i]),
|
||||
incentivesController
|
||||
)
|
||||
),
|
||||
|
|
|
@ -6,6 +6,7 @@ import {StableDebtToken} from '../tokenization/StableDebtToken.sol';
|
|||
import {VariableDebtToken} from '../tokenization/VariableDebtToken.sol';
|
||||
import {LendingRateOracle} from '../mocks/oracle/LendingRateOracle.sol';
|
||||
import {Ownable} from '../dependencies/openzeppelin/contracts/Ownable.sol';
|
||||
import {StringLib} from '../libraries/helpers/StringLib.sol';
|
||||
|
||||
contract StableAndVariableTokensHelper is Ownable {
|
||||
address payable private pool;
|
||||
|
@ -17,10 +18,6 @@ contract StableAndVariableTokensHelper is Ownable {
|
|||
addressesProvider = _addressesProvider;
|
||||
}
|
||||
|
||||
function concat(string memory a, string memory b) internal pure returns (string memory) {
|
||||
return string(abi.encodePacked(a, b));
|
||||
}
|
||||
|
||||
function initDeployment(
|
||||
address[] calldata tokens,
|
||||
string[] calldata symbols,
|
||||
|
@ -34,8 +31,8 @@ contract StableAndVariableTokensHelper is Ownable {
|
|||
new StableDebtToken(
|
||||
pool,
|
||||
tokens[i],
|
||||
concat('Aave stable debt bearing ', symbols[i]),
|
||||
concat('stableDebt', symbols[i]),
|
||||
StringLib.concat('Aave stable debt bearing ', symbols[i]),
|
||||
StringLib.concat('stableDebt', symbols[i]),
|
||||
incentivesController
|
||||
)
|
||||
),
|
||||
|
@ -43,8 +40,8 @@ contract StableAndVariableTokensHelper is Ownable {
|
|||
new VariableDebtToken(
|
||||
pool,
|
||||
tokens[i],
|
||||
concat('Aave variable debt bearing ', symbols[i]),
|
||||
concat('variableDebt', symbols[i]),
|
||||
StringLib.concat('Aave variable debt bearing ', symbols[i]),
|
||||
StringLib.concat('variableDebt', symbols[i]),
|
||||
incentivesController
|
||||
)
|
||||
)
|
||||
|
|
8
contracts/libraries/helpers/StringLib.sol
Normal file
8
contracts/libraries/helpers/StringLib.sol
Normal file
|
@ -0,0 +1,8 @@
|
|||
// SPDX-License-Identifier: agpl-3.0
|
||||
pragma solidity ^0.6.8;
|
||||
|
||||
library StringLib {
|
||||
function concat(string memory a, string memory b) internal pure returns (string memory) {
|
||||
return string(abi.encodePacked(a, b));
|
||||
}
|
||||
}
|
|
@ -163,26 +163,25 @@
|
|||
},
|
||||
"ReserveLogic": {
|
||||
"buidlerevm": {
|
||||
"address": "0x78Ee8Fb9fE5abD5e347Fc94c2fb85596d1f60e3c",
|
||||
"address": "0xFAe0fd738dAbc8a0426F47437322b6d026A9FD95",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
"GenericLogic": {
|
||||
"buidlerevm": {
|
||||
"address": "0x920d847fE49E54C19047ba8bc236C45A8068Bca7",
|
||||
"address": "0x6082731fdAba4761277Fb31299ebC782AD3bCf24",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
"ValidationLogic": {
|
||||
"buidlerevm": {
|
||||
"address": "0xA4765Ff72A9F3CfE73089bb2c3a41B838DF71574",
|
||||
"address": "0x8456161947DFc1fC159A0B26c025cD2b4bba0c3e",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
"LendingPool": {
|
||||
"buidlerevm": {
|
||||
"address": "0x35c1419Da7cf0Ff885B8Ef8EA9242FEF6800c99b",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
"address": "0xD9273d497eDBC967F39d419461CfcF382a0A822e"
|
||||
}
|
||||
},
|
||||
"LendingPoolConfigurator": {
|
||||
|
@ -247,5 +246,23 @@
|
|||
"address": "0x1256eBA4d0a7A38D10BaF4F61775ba491Ce7EE25",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
"MockAToken": {
|
||||
"buidlerevm": {
|
||||
"address": "0x77B0b5636fEA30eA79BB65AeCCdb599997A849A8",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
"MockStableDebtToken": {
|
||||
"buidlerevm": {
|
||||
"address": "0x78Ee8Fb9fE5abD5e347Fc94c2fb85596d1f60e3c",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
},
|
||||
"MockVariableDebtToken": {
|
||||
"buidlerevm": {
|
||||
"address": "0x920d847fE49E54C19047ba8bc236C45A8068Bca7",
|
||||
"deployer": "0xc783df8a850f42e7F7e57013759C285caa701eB6"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
"test-deploy": "buidler test test/__setup.spec.ts test/test-init.spec.ts",
|
||||
"test-pausable": "buidler test test/__setup.spec.ts test/pausable-functions.spec.ts",
|
||||
"test-permit": "buidler test test/__setup.spec.ts test/atoken-permit.spec.ts",
|
||||
"test-stable-and-atokens": "buidler test test/__setup.spec.ts test/atoken-transfer.spec.ts test/stable-token.spec.ts",
|
||||
"test-subgraph:scenarios": "buidler --network buidlerevm_docker test test/__setup.spec.ts test/subgraph-scenarios.spec.ts",
|
||||
"dev:coverage": "buidler coverage --network coverage",
|
||||
"dev:deployment": "buidler dev-deployment",
|
||||
|
|
|
@ -36,6 +36,10 @@ makeSuite('AToken: Transfer', (testEnv: TestEnv) => {
|
|||
|
||||
await aDai.connect(users[0].signer).transfer(users[1].address, amountDAItoDeposit);
|
||||
|
||||
const name = await aDai.name();
|
||||
|
||||
expect(name).to.be.equal('Aave interest bearing DAI');
|
||||
|
||||
const fromBalance = await aDai.balanceOf(users[0].address);
|
||||
const toBalance = await aDai.balanceOf(users[1].address);
|
||||
|
||||
|
|
|
@ -34,6 +34,9 @@ makeSuite('Stable debt token tests', (testEnv: TestEnv) => {
|
|||
daiStableDebtTokenAddress
|
||||
);
|
||||
|
||||
const name = await stableDebtContract.name();
|
||||
|
||||
expect(name).to.be.equal('Aave stable debt bearing DAI');
|
||||
await expect(stableDebtContract.burn(deployer.address, '1')).to.be.revertedWith(
|
||||
CALLER_MUST_BE_LENDING_POOL
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue
Block a user