Skip to content

Commit 3d96ac5

Browse files
committed
fix: infinifi minor fixes
1 parent 33716e2 commit 3d96ac5

File tree

5 files changed

+31
-3
lines changed

5 files changed

+31
-3
lines changed

contracts/adapters/infinifi/InfinifiGatewayAdapter.sol

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ contract InfinifiGatewayAdapter is AbstractAdapter, IInfinifiGatewayAdapter {
3939
/// @notice The mapping of unwinding epochs to locked tokens
4040
mapping(uint32 => address) public unwindingEpochToLockedToken;
4141

42+
/// @notice The mapping of locked tokens to unwinding epochs
43+
mapping(address => uint32) public lockedTokenToUnwindingEpoch;
44+
4245
/// @notice Constructor
4346
/// @param _creditManager Credit manager address
4447
/// @param _infinifiGateway Infinifi Gateway address
@@ -235,8 +238,10 @@ contract InfinifiGatewayAdapter is AbstractAdapter, IInfinifiGatewayAdapter {
235238
_allowedLockedTokens.add(lockedTokens[i].lockedToken);
236239
_getMaskOrRevert(lockedTokens[i].lockedToken);
237240
unwindingEpochToLockedToken[lockedTokens[i].unwindingEpochs] = lockedTokens[i].lockedToken;
241+
lockedTokenToUnwindingEpoch[lockedTokens[i].lockedToken] = lockedTokens[i].unwindingEpochs;
238242
} else {
239243
_allowedLockedTokens.remove(lockedTokens[i].lockedToken);
244+
delete lockedTokenToUnwindingEpoch[lockedTokens[i].lockedToken];
240245
}
241246

242247
emit SetLockedTokenStatus(

contracts/adapters/infinifi/InfinifiUnwindingGatewayAdapter.sol

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ contract InfinifiUnwindingGatewayAdapter is AbstractAdapter, IInfinifiUnwindingG
3636
/// @notice The mapping of unwinding epochs to locked tokens
3737
mapping(uint32 => address) public unwindingEpochToLockedToken;
3838

39+
/// @notice The mapping of locked tokens to unwinding epochs
40+
mapping(address => uint32) public lockedTokenToUnwindingEpoch;
41+
3942
address public immutable infinifiUnwindingPhantomToken;
4043

4144
constructor(address _creditManager, address _infinifiUnwindingGateway, address _infinifiUnwindingPhantomToken)
@@ -88,7 +91,7 @@ contract InfinifiUnwindingGatewayAdapter is AbstractAdapter, IInfinifiUnwindingG
8891

8992
function setLockedTokenBatchStatus(LockedTokenStatus[] calldata lockedTokens) external configuratorOnly {
9093
uint256 len = lockedTokens.length;
91-
address lockingController = IInfinifiGateway(targetContract).getAddress("lockingController");
94+
address lockingController = IInfinifiUnwindingGateway(targetContract).lockingController();
9295
for (uint256 i; i < len; ++i) {
9396
if (
9497
IInfinifiLockingController(lockingController).shareToken(lockedTokens[i].unwindingEpochs)
@@ -101,8 +104,10 @@ contract InfinifiUnwindingGatewayAdapter is AbstractAdapter, IInfinifiUnwindingG
101104
_allowedLockedTokens.add(lockedTokens[i].lockedToken);
102105
_getMaskOrRevert(lockedTokens[i].lockedToken);
103106
unwindingEpochToLockedToken[lockedTokens[i].unwindingEpochs] = lockedTokens[i].lockedToken;
107+
lockedTokenToUnwindingEpoch[lockedTokens[i].lockedToken] = lockedTokens[i].unwindingEpochs;
104108
} else {
105109
_allowedLockedTokens.remove(lockedTokens[i].lockedToken);
110+
delete lockedTokenToUnwindingEpoch[lockedTokens[i].lockedToken];
106111
}
107112

108113
emit SetLockedTokenStatus(

contracts/helpers/infinifi/InfinifiUnwindingGateway.sol

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ contract InfinifiUnwindingGateway is IInfinifiUnwindingGateway {
3636

3737
mapping(address => UserUnwindingData) public userToUnwindingData;
3838

39-
mapping(address => uint256) public userToTotalRedemptions;
40-
4139
constructor(address _infinifiGateway) {
4240
infinifiGateway = _infinifiGateway;
4341
iUSD = IInfinifiGateway(infinifiGateway).getAddress("receiptToken");

contracts/integrations/infinifi/IInfinifiGateway.sol

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,18 @@ interface IInfinifiGateway {
3131

3232
interface IInfinifiMintController {
3333
function receiptToken() external view returns (address);
34+
35+
function assetToReceipt(uint256 _assetAmount) external view returns (uint256);
3436
}
3537

3638
interface IInfinifiLockingController {
39+
function getEnabledBuckets() external view returns (uint32[] memory);
40+
3741
function shareToken(uint32 unwindingEpochs) external view returns (address);
3842

3943
function unwindingModule() external view returns (address);
44+
45+
function exchangeRate(uint32 unwindingEpochs) external view returns (uint256);
4046
}
4147

4248
interface IInfinifiUnwindingModule {
@@ -47,4 +53,10 @@ interface IInfinifiUnwindingModule {
4753

4854
interface IInfinifiRedeemController {
4955
function receiptToAsset(uint256 amount) external view returns (uint256);
56+
57+
function accounting() external view returns (address);
58+
}
59+
60+
interface IInfinifiAccounting {
61+
function totalAssetsOf(address asset, uint256 farmType) external view returns (uint256);
5062
}

contracts/interfaces/infinifi/IInfinifiGatewayAdapter.sol

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ interface IInfinifiGatewayExceptions {
2525

2626
/// @title Infinifi Gateway adapter interface
2727
interface IInfinifiGatewayAdapter is IAdapter, IInfinifiGatewayExceptions, IInfinifiGatewayEvents {
28+
function usdc() external view returns (address);
29+
30+
function iusd() external view returns (address);
31+
32+
function siusd() external view returns (address);
33+
2834
function mint(address to, uint256 amount) external returns (bool useSafePrices);
2935

3036
function mintDiff(uint256 leftoverAmount) external returns (bool useSafePrices);
@@ -47,5 +53,7 @@ interface IInfinifiGatewayAdapter is IAdapter, IInfinifiGatewayExceptions, IInfi
4753

4854
function claimRedemption() external returns (bool useSafePrices);
4955

56+
function getAllowedLockedTokens() external view returns (address[] memory);
57+
5058
function setLockedTokenBatchStatus(LockedTokenStatus[] calldata lockedTokens) external;
5159
}

0 commit comments

Comments
 (0)