Skip to content

Commit 66ed82f

Browse files
authored
feat: casting interfaces types on storage vars (#13)
# 🤖 Linear Closes CON-XXX
1 parent 37f5fdd commit 66ed82f

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

solidity/contracts/ConnextVestingWallet.sol

+7-7
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ contract ConnextVestingWallet is Ownable2Step, IConnextVestingWallet {
2929
uint64 public constant NEXT_TOKEN_LAUNCH = SEPT_05_2023; // Equals to Sept 5th 2023
3030

3131
/// @inheritdoc IConnextVestingWallet
32-
address public constant NEXT_TOKEN = 0xFE67A4450907459c3e1FFf623aA927dD4e28c67a; // Mainnet NEXT token address
32+
IERC20 public constant NEXT_TOKEN = IERC20(0xFE67A4450907459c3e1FFf623aA927dD4e28c67a); // Mainnet NEXT token address
3333

3434
/// @inheritdoc IConnextVestingWallet
3535
uint64 public constant UNLOCK_DURATION = ONE_YEAR + ONE_MONTH; // 13 months duration
@@ -85,14 +85,14 @@ contract ConnextVestingWallet is Ownable2Step, IConnextVestingWallet {
8585
function release() public {
8686
uint256 _amount = releasable();
8787
released += _amount;
88-
IERC20(NEXT_TOKEN).transfer(owner(), _amount);
89-
emit ERC20Released(NEXT_TOKEN, _amount);
88+
NEXT_TOKEN.transfer(owner(), _amount);
89+
emit ERC20Released(address(NEXT_TOKEN), _amount);
9090
}
9191

9292
/// @inheritdoc IConnextVestingWallet
9393
function releasable() public view returns (uint256 _amount) {
9494
_amount = vestedAmount(uint64(block.timestamp)) - released;
95-
uint256 _balance = IERC20(NEXT_TOKEN).balanceOf(address(this));
95+
uint256 _balance = NEXT_TOKEN.balanceOf(address(this));
9696
_amount = _balance < _amount ? _balance : _amount;
9797
}
9898

@@ -103,7 +103,7 @@ contract ConnextVestingWallet is Ownable2Step, IConnextVestingWallet {
103103
function sendDust(IERC20 _token, uint256 _amount, address _to) external onlyOwner {
104104
if (_to == address(0)) revert ZeroAddress();
105105

106-
if (_token == IERC20(NEXT_TOKEN) && released != TOTAL_AMOUNT) {
106+
if (_token == NEXT_TOKEN && released != TOTAL_AMOUNT) {
107107
revert NotAllowed();
108108
}
109109

@@ -118,7 +118,7 @@ contract ConnextVestingWallet is Ownable2Step, IConnextVestingWallet {
118118
* @inheritdoc IConnextVestingWallet
119119
* @dev This func is needed because only the recipients can claim
120120
*/
121-
function claim(address _llamaVestAddress) external {
122-
IVestingEscrowSimple(_llamaVestAddress).claim(address(this));
121+
function claim(IVestingEscrowSimple _llamaVest) external {
122+
_llamaVest.claim(address(this));
123123
}
124124
}

solidity/interfaces/IConnextVestingWallet.sol

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// SPDX-License-Identifier: MIT
22
pragma solidity 0.8.20;
33

4+
import {IVestingEscrowSimple} from './IVestingEscrowSimple.sol';
45
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
56

67
interface IConnextVestingWallet {
@@ -37,7 +38,7 @@ interface IConnextVestingWallet {
3738
* @notice NEXT token address
3839
* @return _nextToken The address of the NEXT token
3940
*/
40-
function NEXT_TOKEN() external view returns (address _nextToken);
41+
function NEXT_TOKEN() external view returns (IERC20 _nextToken);
4142

4243
/**
4344
* @notice Token launch date
@@ -121,9 +122,9 @@ interface IConnextVestingWallet {
121122

122123
/**
123124
* @notice Claim tokens from Llama Vesting contract
124-
* @param _llamaVestAddress The address of the Llama Vesting contract
125+
* @param _llamaVest The address of the Llama Vesting contract
125126
*/
126-
function claim(address _llamaVestAddress) external;
127+
function claim(IVestingEscrowSimple _llamaVest) external;
127128

128129
/**
129130
* @notice Collect dust from the contract

solidity/test/integration/LlamaVesting.t.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ contract IntegrationLlamaVesting is IntegrationBase {
5050
*/
5151
function _warpAndWithdraw(uint256 _timestamp) internal {
5252
vm.warp(_timestamp);
53-
_connextVestingWallet.claim(address(_llamaVest));
53+
_connextVestingWallet.claim(_llamaVest);
5454
_connextVestingWallet.release();
5555
}
5656

0 commit comments

Comments
 (0)