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

adding smart contract changes #27

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'standard',
'plugin:promise/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
plugins: ['mocha-no-only', 'promise', 'prettier', '@typescript-eslint'],
env: {
browser: true,
node: true,
mocha: true,
jest: true,
},
globals: {
artifacts: false,
contract: false,
assert: false,
web3: false,
usePlugin: false,
extendEnvironment: false,
},
rules: {
// Strict mode
strict: ['error', 'global'],
'prettier/prettier': 'error',
// Code style
'array-bracket-spacing': ['off'],
camelcase: [
'error',
{ properties: 'always', ignoreImports: true, allow: ['(.*?)__factory'] },
],
'comma-dangle': ['error', 'always-multiline'],
'comma-spacing': ['error', { before: false, after: true }],
'dot-notation': ['error', { allowKeywords: true, allowPattern: '' }],
'eol-last': ['error', 'always'],
eqeqeq: ['error', 'smart'],
'generator-star-spacing': ['error', 'before'],
'linebreak-style': ['error', 'unix'],
'max-len': ['error', 150, 2, { ignoreComments: true }],
'no-debugger': 'off',
'no-dupe-args': 'error',
'no-dupe-keys': 'error',
'no-mixed-spaces-and-tabs': ['error', 'smart-tabs'],
'no-redeclare': ['error', { builtinGlobals: true }],
'no-trailing-spaces': ['error', { skipBlankLines: false }],
'no-undef': 'error',
'no-use-before-define': 'off',
'no-var': 'error',
'object-curly-spacing': ['error', 'always'],
'prefer-const': 'error',
quotes: ['error', 'single'],
semi: ['error', 'always'],
'space-before-function-paren': 0,
'@typescript-eslint/no-non-null-assertion': 0,

'mocha-no-only/mocha-no-only': ['error'],

'promise/always-return': 'off',
'promise/avoid-new': 'off',
},
overrides: [
{
files: ['*.js'],
rules: {
'@typescript-eslint/no-var-requires': [0],
},
},
{
files: ['./test/**/*'],
rules: {
camelcase: [0],
},
},
],
parserOptions: {
ecmaVersion: 2018,
},
}
20 changes: 20 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"arrowParens": "avoid",
"jsxSingleQuote": true,
"singleQuote": true,
"printWidth": 120,
"semi": true,
"trailingComma": "all",
"useTabs": false,
"overrides": [
{
"files": "*.sol",
"options": {
"printWidth": 120,
"singleQuote": false,
"bracketSpacing": true,
"explicitTypes": "always"
}
}
]
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ For a broader overview of the protocol and its different modules, you can also c

Other Angle-related smart contracts can be found in the following repositories:

- [Angle Borrowing module contracts](https://github.com/AngleProtocol/angle-borrow)
- [Angle Borrowing module contracts](https://github.com/AngleProtocol/borrow-contracts)
- [Angle Strategies](https://github.com/AngleProtocol/angle-strategies)

Otherwise, for more info about the protocol, check out [this portal](https://linktr.ee/angleprotocol) of resources.
Expand All @@ -43,7 +43,7 @@ Some smart contracts of the protocol, beyond strategy contracts, are used across
Here are some cross-module contracts and the repos in which you should look for their correct and latest version:

- [`angle-core`](https://github.com/AngleProtocol/angle-core): All DAO-related contracts (`ANGLE`, `veANGLE`, gauges, surplus distribution, ...), `AngleRouter` contract
- [`angle-borrow`](https://github.com/AngleProtocol/angle-borrow): `agToken` contract
- [`borrow-contracts`](https://github.com/AngleProtocol/borrow-contracts): `agToken` contract
- [`angle-strategies`](https://github.com/AngleProtocol/angle-strategies): Yield strategies of the protocol

### Error Messages
Expand Down
4 changes: 2 additions & 2 deletions contracts/oracle/OracleChainlinkMultiEfficient.sol
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ abstract contract OracleChainlinkMultiEfficient is ChainlinkUtils {
/// @return The `quoteAmount` converted in EUR
/// @dev If `quoteAmount` is `BASE_TOKENS`, the output is the oracle rate
function _quoteChainlink(uint256 quoteAmount) internal view returns (uint256) {
AggregatorV3Interface[2] memory circuitChainlink = _circuitChainlink();
AggregatorV3Interface[2] memory circuitChainlink = circuitChainlink();
uint8[2] memory circuitChainIsMultiplied = _circuitChainIsMultiplied();
uint8[2] memory chainlinkDecimals = _chainlinkDecimals();
for (uint256 i = 0; i < circuitChainlink.length; i++) {
Expand All @@ -100,7 +100,7 @@ abstract contract OracleChainlinkMultiEfficient is ChainlinkUtils {
}

/// @notice Returns the array of the Chainlink feeds to look at
function _circuitChainlink() internal pure virtual returns (AggregatorV3Interface[2] memory);
function circuitChainlink() public pure virtual returns (AggregatorV3Interface[2] memory);

/// @notice Base of the inToken
function _inBase() internal pure virtual returns (uint256);
Expand Down
4 changes: 2 additions & 2 deletions contracts/oracle/OracleChainlinkMultiEfficientWithKeeper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ abstract contract OracleChainlinkMultiEfficientWithKeeper is ChainlinkUtilsWithK
/// @return The `quoteAmount` converted in EUR
/// @dev If `quoteAmount` is `BASE_TOKENS`, the output is the oracle rate
function _quoteChainlink(uint256 quoteAmount) internal view returns (uint256) {
AggregatorV3Interface[2] memory circuitChainlink = _circuitChainlink();
AggregatorV3Interface[2] memory circuitChainlink = circuitChainlink();
uint8[2] memory circuitChainlinkIsPausable = _circuitChainlinkIsPausable();
uint8[2] memory circuitChainIsMultiplied = _circuitChainIsMultiplied();
uint8[2] memory chainlinkDecimals = _chainlinkDecimals();
Expand All @@ -108,7 +108,7 @@ abstract contract OracleChainlinkMultiEfficientWithKeeper is ChainlinkUtilsWithK
}

/// @notice Returns the array of the Chainlink feeds to look at
function _circuitChainlink() internal pure virtual returns (AggregatorV3Interface[2] memory);
function circuitChainlink() public pure virtual returns (AggregatorV3Interface[2] memory);

/// @notice Base of the inToken
function _inBase() internal pure virtual returns (uint256);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ contract OracleUSDCEURChainlink is OracleChainlinkMultiEfficient {
OracleChainlinkMultiEfficient(_stalePeriod, guardians)
{}

function _circuitChainlink() internal pure override returns (AggregatorV3Interface[2] memory) {
function circuitChainlink() public pure override returns (AggregatorV3Interface[2] memory) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually this need to be changed as I am doing in the borrow staked contracts. With undefined sizes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah shit, has it been fixed in angle-solidity?

return [
// Oracle USDC/USD
AggregatorV3Interface(0x8fFfFfd4AfB6115b954Bd326cbe7B4BA576818f6),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ contract OracleUSDCEURChainlinkWithKeeper is OracleChainlinkMultiEfficientWithKe
) OracleChainlinkMultiEfficientWithKeeper(_stalePeriod, _pausingPeriod, _coreBorrow, _keeperRegistry) {}

/// @inheritdoc OracleChainlinkMultiEfficientWithKeeper
function _circuitChainlink() internal pure override returns (AggregatorV3Interface[2] memory) {
function circuitChainlink() public pure override returns (AggregatorV3Interface[2] memory) {
return [
// Oracle USDC/USD
AggregatorV3Interface(0x8fFfFfd4AfB6115b954Bd326cbe7B4BA576818f6),
Expand Down
Loading