Skip to content

Commit 9f53d0e

Browse files
committed
fix: update diff
1 parent 86ef1fc commit 9f53d0e

2 files changed

Lines changed: 35 additions & 33 deletions

File tree

docs/3.4/appendix/ATokenWithDelegation.diff

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
1-
diff --git a/docs/3.4/diffs/ATokenWithDelegation.sol b/src/contracts/protocol/tokenization/ATokenWithDelegation.sol
2-
index b3967209..717e91a9 100644
3-
--- a/docs/3.4/diffs/ATokenWithDelegation.sol
1+
diff --git a/docs/3.4/ATokenWithDelegation.sol b/src/contracts/protocol/tokenization/ATokenWithDelegation.sol
2+
index b3967209..0d3d4b7b 100644
3+
--- a/docs/3.4/ATokenWithDelegation.sol
44
+++ b/src/contracts/protocol/tokenization/ATokenWithDelegation.sol
5-
@@ -1,17 +1,23 @@
5+
@@ -1,17 +1,24 @@
66
-// SPDX-License-Identifier: MIT
77
-pragma solidity ^0.8.0;
88
+// SPDX-License-Identifier: BUSL-1.1
99
+pragma solidity ^0.8.10;
1010
+
1111
+import {WadRayMath} from '../libraries/math/WadRayMath.sol';
1212
+import {IPool} from '../../interfaces/IPool.sol';
13-
13+
1414
-import {IPool} from 'aave-v3-core/contracts/interfaces/IPool.sol';
1515
-import {BaseDelegation} from 'aave-token-v3/BaseDelegation.sol';
1616
import {AToken} from './AToken.sol';
17-
17+
1818
+import {DelegationMode} from './base/DelegationMode.sol';
1919
+import {BaseDelegation} from './delegation/BaseDelegation.sol';
2020
+
2121
/**
22+
+ * @title Aave ERC20 ATokenWithDelegation
2223
* @author BGD Labs
2324
* @notice contract that gives a tokens the delegation functionality. For now should only be used for AAVE aToken
2425
* @dev uint sizes are used taken into account that is tailored for AAVE token. In this AToken child we only update
@@ -31,10 +32,10 @@ index b3967209..717e91a9 100644
3132
struct ATokenDelegationState {
3233
uint72 delegatedPropositionBalance;
3334
uint72 delegatedVotingBalance;
34-
@@ -19,7 +25,17 @@ contract ATokenWithDelegation is AToken, BaseDelegation {
35-
35+
@@ -19,7 +26,17 @@ contract ATokenWithDelegation is AToken, BaseDelegation {
36+
3637
mapping(address => ATokenDelegationState) internal _delegatedState;
37-
38+
3839
- constructor(IPool pool) AToken(pool) {}
3940
+ /**
4041
+ * @dev Constructor.
@@ -47,12 +48,12 @@ index b3967209..717e91a9 100644
4748
+ address rewardsController,
4849
+ address treasury
4950
+ ) AToken(pool, rewardsController, treasury) {}
50-
51+
5152
function _getDomainSeparator() internal view override returns (bytes32) {
5253
return DOMAIN_SEPARATOR();
53-
@@ -57,20 +73,36 @@ contract ATokenWithDelegation is AToken, BaseDelegation {
54+
@@ -57,20 +74,36 @@ contract ATokenWithDelegation is AToken, BaseDelegation {
5455
}
55-
56+
5657
/**
5758
- * @notice Overrides the parent _transfer to force validated transfer() and delegation balance transfers
5859
- * @param from The source address
@@ -86,7 +87,7 @@ index b3967209..717e91a9 100644
8687
+
8788
+ super._transfer(from, to, amount, index);
8889
}
89-
90+
9091
/**
9192
* @notice Overrides the parent _mint to force delegation balance transfers
9293
* @param account The address receiving tokens
@@ -95,7 +96,7 @@ index b3967209..717e91a9 100644
9596
*/
9697
function _mint(address account, uint120 amount) internal override {
9798
_delegationChangeOnTransfer(address(0), account, 0, _getBalance(account), amount);
98-
@@ -80,7 +112,7 @@ contract ATokenWithDelegation is AToken, BaseDelegation {
99+
@@ -80,7 +113,7 @@ contract ATokenWithDelegation is AToken, BaseDelegation {
99100
/**
100101
* @notice Overrides the parent _burn to force delegation balance transfers
101102
* @param account The account whose tokens are burnt

docs/3.4/appendix/BaseDelegation.diff

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
diff --git a/docs/3.4/diffs/BaseDelegation.sol b/src/contracts/protocol/tokenization/delegation/BaseDelegation.sol
2-
index c1a95d08..f15ccb69 100644
3-
--- a/docs/3.4/diffs/BaseDelegation.sol
1+
diff --git a/docs/3.4/BaseDelegation.sol b/src/contracts/protocol/tokenization/delegation/BaseDelegation.sol
2+
index c1a95d08..dae21a67 100644
3+
--- a/docs/3.4/BaseDelegation.sol
44
+++ b/src/contracts/protocol/tokenization/delegation/BaseDelegation.sol
5-
@@ -1,11 +1,14 @@
5+
@@ -1,11 +1,15 @@
66
// SPDX-License-Identifier: MIT
7-
pragma solidity ^0.8.0;
7+
-pragma solidity ^0.8.0;
8+
+pragma solidity ^0.8.10;
89

9-
-import {ECDSA} from 'openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol';
1010
+import {MessageHashUtils} from 'openzeppelin-contracts/contracts/utils/cryptography/MessageHashUtils.sol';
11+
import {ECDSA} from 'openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol';
1112
+import {SafeCast} from 'openzeppelin-contracts/contracts/utils/math/SafeCast.sol';
1213

1314
-import {SafeCast72} from './utils/SafeCast72.sol';
@@ -21,7 +22,7 @@ index c1a95d08..f15ccb69 100644
2122

2223
/**
2324
* @notice The contract implements generic delegation functionality for the upcoming governance v3
24-
@@ -18,7 +21,7 @@ import {DelegationMode} from './DelegationAwareBalance.sol';
25+
@@ -18,7 +22,7 @@ import {DelegationMode} from './DelegationAwareBalance.sol';
2526
* otherwise at least POWER_SCALE_FACTOR should be adjusted !!!
2627
* *************************************************************
2728
*/
@@ -30,7 +31,7 @@ index c1a95d08..f15ccb69 100644
3031
struct DelegationState {
3132
uint72 delegatedPropositionBalance;
3233
uint72 delegatedVotingBalance;
33-
@@ -81,7 +84,7 @@ abstract contract BaseDelegation is IGovernancePowerDelegationToken {
34+
@@ -81,7 +85,7 @@ abstract contract BaseDelegation is IGovernancePowerDelegationToken {
3435
DelegationState memory delegationState
3536
) internal virtual;
3637

@@ -39,7 +40,7 @@ index c1a95d08..f15ccb69 100644
3940
function delegateByType(
4041
address delegatee,
4142
GovernancePowerType delegationType
42-
@@ -89,13 +92,13 @@ abstract contract BaseDelegation is IGovernancePowerDelegationToken {
43+
@@ -89,13 +93,13 @@ abstract contract BaseDelegation is IGovernancePowerDelegationToken {
4344
_delegateByType(msg.sender, delegatee, delegationType);
4445
}
4546

@@ -55,7 +56,7 @@ index c1a95d08..f15ccb69 100644
5556
function getDelegateeByType(
5657
address delegator,
5758
GovernancePowerType delegationType
58-
@@ -103,7 +106,7 @@ abstract contract BaseDelegation is IGovernancePowerDelegationToken {
59+
@@ -103,7 +107,7 @@ abstract contract BaseDelegation is IGovernancePowerDelegationToken {
5960
return _getDelegateeByType(delegator, _getDelegationState(delegator), delegationType);
6061
}
6162

@@ -64,7 +65,7 @@ index c1a95d08..f15ccb69 100644
6465
function getDelegates(address delegator) external view override returns (address, address) {
6566
DelegationState memory delegatorBalance = _getDelegationState(delegator);
6667
return (
67-
@@ -112,7 +115,7 @@ abstract contract BaseDelegation is IGovernancePowerDelegationToken {
68+
@@ -112,7 +116,7 @@ abstract contract BaseDelegation is IGovernancePowerDelegationToken {
6869
);
6970
}
7071

@@ -73,7 +74,7 @@ index c1a95d08..f15ccb69 100644
7374
function getPowerCurrent(
7475
address user,
7576
GovernancePowerType delegationType
76-
@@ -122,10 +125,12 @@ abstract contract BaseDelegation is IGovernancePowerDelegationToken {
77+
@@ -122,10 +126,12 @@ abstract contract BaseDelegation is IGovernancePowerDelegationToken {
7778
? _getBalance(user)
7879
: 0;
7980
uint256 userDelegatedPower = _getDelegatedPowerByType(userState, delegationType);
@@ -87,7 +88,7 @@ index c1a95d08..f15ccb69 100644
8788
function getPowersCurrent(address user) external view override returns (uint256, uint256) {
8889
return (
8990
getPowerCurrent(user, GovernancePowerType.VOTING),
90-
@@ -133,7 +138,7 @@ abstract contract BaseDelegation is IGovernancePowerDelegationToken {
91+
@@ -133,7 +139,7 @@ abstract contract BaseDelegation is IGovernancePowerDelegationToken {
9192
);
9293
}
9394

@@ -96,7 +97,7 @@ index c1a95d08..f15ccb69 100644
9697
function metaDelegateByType(
9798
address delegator,
9899
address delegatee,
99-
@@ -143,10 +148,11 @@ abstract contract BaseDelegation is IGovernancePowerDelegationToken {
100+
@@ -143,10 +149,11 @@ abstract contract BaseDelegation is IGovernancePowerDelegationToken {
100101
bytes32 r,
101102
bytes32 s
102103
) external override {
@@ -111,12 +112,12 @@ index c1a95d08..f15ccb69 100644
111112
_getDomainSeparator(),
112113
keccak256(
113114
abi.encode(
114-
@@ -160,11 +166,12 @@ abstract contract BaseDelegation is IGovernancePowerDelegationToken {
115+
@@ -160,11 +167,12 @@ abstract contract BaseDelegation is IGovernancePowerDelegationToken {
115116
)
116117
);
117118

118119
- require(delegator == ECDSA.recover(digest, v, r, s), 'INVALID_SIGNATURE');
119-
+ require(delegator == ecrecover(digest, v, r, s), Errors.InvalidSignature());
120+
+ require(delegator == ECDSA.recover(digest, v, r, s), Errors.InvalidSignature());
120121
+
121122
_delegateByType(delegator, delegatee, delegationType);
122123
}
@@ -126,7 +127,7 @@ index c1a95d08..f15ccb69 100644
126127
function metaDelegate(
127128
address delegator,
128129
address delegatee,
129-
@@ -173,17 +180,19 @@ abstract contract BaseDelegation is IGovernancePowerDelegationToken {
130+
@@ -173,17 +181,19 @@ abstract contract BaseDelegation is IGovernancePowerDelegationToken {
130131
bytes32 r,
131132
bytes32 s
132133
) external override {
@@ -145,12 +146,12 @@ index c1a95d08..f15ccb69 100644
145146
);
146147

147148
- require(delegator == ECDSA.recover(digest, v, r, s), 'INVALID_SIGNATURE');
148-
+ require(delegator == ecrecover(digest, v, r, s), Errors.InvalidSignature());
149+
+ require(delegator == ECDSA.recover(digest, v, r, s), Errors.InvalidSignature());
149150
+
150151
_delegateByType(delegator, delegatee, GovernancePowerType.VOTING);
151152
_delegateByType(delegator, delegatee, GovernancePowerType.PROPOSITION);
152153
}
153-
@@ -213,10 +222,10 @@ abstract contract BaseDelegation is IGovernancePowerDelegationToken {
154+
@@ -213,10 +223,10 @@ abstract contract BaseDelegation is IGovernancePowerDelegationToken {
154155

155156
// we use uint72, because this is the most optimal for AaveTokenV3
156157
// To make delegated balance fit into uint72 we're decreasing precision of delegated balance by POWER_SCALE_FACTOR

0 commit comments

Comments
 (0)