-
Notifications
You must be signed in to change notification settings - Fork 4
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
style: simplify code #7
Conversation
function vestedAmount(uint64) public view virtual override returns (uint256 _amount) { | ||
return 0; | ||
constructor(address _owner, uint256 _totalAmount) Ownable(_owner) { | ||
CLIFF = VESTING_START_DATE + VESTING_CLIFF_DURATION; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CLIFF is basically VESTING_START_DATE + 1 year
no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CLIFF is basically
VESTING_START_DATE + 1 year
no?
VESTING_START_DATE + 1 month
. It's used just once so we could replace it with VESTING_START_DATE + VESTING_CLIFF_DURATION
in the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh ok, i think is good there, mmmm maybe rename to VESTING_CLIFF
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VESTING_CLIFF
I'd remove it at all or moved its declaration to constants. Setting constants in constructor doesn't make sense
|
||
/** | ||
* @notice NEXT tokens released | ||
* @param _token The address of the NEXT token |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*of the released ERC20 token
/** | ||
* @notice Sept 5th 2023 in seconds | ||
* @return _timedelta The timestamp of Sept 5th 2023 | ||
*/ | ||
function SEPT_05_2023() external view returns (uint64 _timedelta); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a timedelta, unix timestamp!
|
||
/** | ||
* @notice Vesting warmup time | ||
* @dev 11 months offset |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm not sure if @dev
comments are correct in the interface, because they're talking about the immutable variable that's on the contract, it doesn't make sense to assume in the interface that this will return 11 months offset
i'd move the @dev
comments to the contract
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm not sure if
@dev
comments are correct in the interface, because they're talking about the immutable variable that's on the contract, it doesn't make sense to assume in the interface that this will return11 months offset
i'd move the
@dev
comments to the contract
we could remove it because it doesn't make sense to add @dev natspec to constants. Or we can do //
comments after them
*/ | ||
uint64 public constant VESTING_START_DATE = NEXT_TOKEN_LAUNCH + VESTING_OFFSET; | ||
/// @inheritdoc IConnextVestingWallet | ||
uint64 public constant VESTING_CLIFF = VESTING_START_DATE + VESTING_CLIFF_DURATION; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing // Sept 5th 2024
comment
function VESTING_CLIFF_DURATION() external view returns (uint64 _timedelta); | ||
|
||
/** | ||
* @notice Vesting duration including one month of cliff |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*including cliff duration
*/ | ||
address public constant NEXT_TOKEN = 0xFE67A4450907459c3e1FFf623aA927dD4e28c67a; | ||
/// @inheritdoc IConnextVestingWallet | ||
address public constant NEXT_TOKEN = 0xFE67A4450907459c3e1FFf623aA927dD4e28c67a; // Mainnet address |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Mainnet NEXT token address
function vestedAmount(uint64 _timestamp) public view returns (uint256 _amount) { | ||
if (_timestamp < VESTING_CLIFF) { | ||
return 0; | ||
} else if (_timestamp >= VESTING_START) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how come this is passing the tests?
} else if (_timestamp >= VESTING_START) { | |
} else if (_timestamp >= VESTING_END) { |
|
||
/// @inheritdoc IConnextVestingWallet | ||
uint64 public immutable CLIFF; | ||
uint64 public constant VESTING_START = VESTING_START_DATE + VESTING_DURATION; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WRONG NAMING!!
*/ | ||
uint64 public constant VESTING_OFFSET = ONE_YEAR - ONE_MONTH; | ||
/// @inheritdoc IConnextVestingWallet | ||
uint64 public constant VESTING_START = NEXT_TOKEN_LAUNCH + VESTING_OFFSET; // Aug 5th 2024 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the change pal?? it was ok Sept 5th - 1mth
STORAGE | ||
//////////////////////////////////////////////////////////////*/ | ||
/// @inheritdoc IConnextVestingWallet | ||
uint64 public constant VESTING_END = VESTING_START + VESTING_DURATION; // Sept 5th 2025 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i believe we should be talking about UNLOCK
instead of VEST
, @0xGorilla ?
solidity/test/utils/Constants.sol
Outdated
uint64 public constant VESTING_DURATION = 365 days * 4; | ||
uint64 public constant UNLOCK_DURATION = 365 days * 4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOOOOOOO!O!O!!O!O!O!O! hahhaha
this is actually the vest that goes into llamapay, it's 4ys, is a VEST
NEXT_TOKEN_ADDRESS, address(_connextVestingWallet), TOTAL_AMOUNT, VESTING_DURATION, AUG_01_2022, 0 | ||
NEXT_TOKEN_ADDRESS, address(_connextVestingWallet), TOTAL_AMOUNT, UNLOCK_DURATION, AUG_01_2022, 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrong naming
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- please change test pk from env to tests, and random would be better !
Also:
Encountered 1 failing test in solidity/test/integration/LlamaVesting.t.sol:IntegrationLlamaVesting
[FAIL. Reason: setup failed: environment variable "DEPLOYER_PRIVATE_KEY" not found] setUp() (gas: 0)
-
It seems it needs
DEPLOYER_PRIVATE_KEY
(the same you are setting on the action rn), but its not implemented on the.env.example
so it fails locally. Adding it to the env fixes it tho. -
Just to confirm recheck coverage for
solidity/contracts/ConnextVestingWallet.sol
. Are we ok with that %? -
Also why MAX_DELTA is so high? (1 ether)
I would use justassertEq
on all the cases. Only LlamaVesting tests error without delta. -
Recheck all constants, like
PAY_PER_SECOND
. Some are not used anymore. Also theLlamaVesting.t.sol
could use more comments explainingVestAndUnlock
test numbers (Like in the other test)
Overall is pretty clean and secure, amazing job!
assertApproxEqAbs( | ||
_connextVestingWallet.vestedAmount(NEXT_TOKEN_ADDRESS, _firstMilestoneTimestamp + MONTH), 2 ether, MAX_DELTA | ||
); | ||
assertApproxEqAbs(_connextVestingWallet.vestedAmount(_firstMilestoneTimestamp + MONTH), 2 ether, MAX_DELTA); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why MAX_DELTA is so high? (1 ether)
I would use just assertEq
on this case and all this file cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why MAX_DELTA is so high? (1 ether) I would use just
assertEq
on this case and all this file cases
mostly because we use approximate datatimes, like 30 days = 1 month, but 1 month also = 1/12 year, which is 365 days.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But in this case I mean.
assertApproxEqAbs(_connextVestingWallet.vestedAmount(_firstMilestoneTimestamp + MONTH), 2 ether, MAX_DELTA);
You are comparing the vestedAmount, to 2 ether. With a delta of 1 ether. In this specific case it is wrong. If you use assertEq
it will work just fine without delta
The feedback has been addressed 🐢
No description provided.