@venusprotocol/liquidity-hub 2.1.0-dev.1 → 2.1.0-dev.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/contracts/Hub/Hub.sol +2 -0
- package/contracts/YieldGroup/YieldGroupCentrifuge.sol +6 -0
- package/contracts/YieldGroup/base/YieldGroupBase.sol +2 -0
- package/deployments/bscmainnet/CentrifugeSource_USDC.json +1708 -0
- package/deployments/bscmainnet_addresses.json +1 -0
- package/package.json +3 -1
package/contracts/Hub/Hub.sol
CHANGED
|
@@ -26,6 +26,8 @@ import { HubAdminLib } from "./lib/HubAdminLib.sol";
|
|
|
26
26
|
* Inheritance order is load-bearing for upgrade safety — do not reorder.
|
|
27
27
|
* Function ordering follows the Solidity style guide: external → public → internal →
|
|
28
28
|
* private, mutating before view within each group.
|
|
29
|
+
* {HubAdminLib} is linked for EIP-170 headroom; a library declares no state, so it cannot shift this layout.
|
|
30
|
+
* @custom:oz-upgrades-unsafe-allow external-library-linking
|
|
29
31
|
*/
|
|
30
32
|
contract Hub is ERC4626Upgradeable, AccessControlledV8, ReentrancyGuardUpgradeable, HubStorage, IHub {
|
|
31
33
|
using SafeERC20Upgradeable for IERC20Upgradeable;
|
|
@@ -120,6 +120,7 @@ contract YieldGroupCentrifuge is YieldGroupBase, NavGuard, IYieldGroupCentrifuge
|
|
|
120
120
|
/// @inheritdoc IYieldGroupCentrifuge
|
|
121
121
|
/// @dev Allowed while the resource is paused as a wind-down action. Cancelling a redeem request
|
|
122
122
|
/// is asynchronous and may block another redeem request until Centrifuge settles the cancellation.
|
|
123
|
+
/// @custom:oz-upgrades-unsafe-allow-reachable delegatecall
|
|
123
124
|
function requestRedeem(address resource, uint256 shares) external override nonReentrant {
|
|
124
125
|
_checkAccessAllowed("requestRedeem(address,uint256)");
|
|
125
126
|
if (shares == 0) revert ZeroShares();
|
|
@@ -129,6 +130,7 @@ contract YieldGroupCentrifuge is YieldGroupBase, NavGuard, IYieldGroupCentrifuge
|
|
|
129
130
|
}
|
|
130
131
|
|
|
131
132
|
/// @inheritdoc IYieldGroupCentrifuge
|
|
133
|
+
/// @custom:oz-upgrades-unsafe-allow-reachable delegatecall
|
|
132
134
|
function cancelDepositRequest(address resource) external override nonReentrant {
|
|
133
135
|
_checkAccessAllowed("cancelDepositRequest(address)");
|
|
134
136
|
address adapter = _requireRegistered(resource);
|
|
@@ -137,6 +139,7 @@ contract YieldGroupCentrifuge is YieldGroupBase, NavGuard, IYieldGroupCentrifuge
|
|
|
137
139
|
}
|
|
138
140
|
|
|
139
141
|
/// @inheritdoc IYieldGroupCentrifuge
|
|
142
|
+
/// @custom:oz-upgrades-unsafe-allow-reachable delegatecall
|
|
140
143
|
function cancelRedeemRequest(address resource) external override nonReentrant {
|
|
141
144
|
_checkAccessAllowed("cancelRedeemRequest(address)");
|
|
142
145
|
address adapter = _requireRegistered(resource);
|
|
@@ -381,6 +384,7 @@ contract YieldGroupCentrifuge is YieldGroupBase, NavGuard, IYieldGroupCentrifuge
|
|
|
381
384
|
/// The band already counted this deposit at {_dispatchDeposit}, while it was still pending.
|
|
382
385
|
/// Settling it and claiming it only move it between buckets at the same value, so recording
|
|
383
386
|
/// it again here would count the same assets twice.
|
|
387
|
+
/// @custom:oz-upgrades-unsafe-allow-reachable delegatecall
|
|
384
388
|
function _claimDeposit(address resource, address adapter) private returns (uint256 shares) {
|
|
385
389
|
bytes memory ret = adapter.functionDelegateCall(abi.encodeCall(IAdapterCentrifuge.claimDeposit, (resource)));
|
|
386
390
|
shares = abi.decode(ret, (uint256));
|
|
@@ -390,6 +394,7 @@ contract YieldGroupCentrifuge is YieldGroupBase, NavGuard, IYieldGroupCentrifuge
|
|
|
390
394
|
/// @dev Runs an asset-delivering claim and returns what actually landed on this contract's
|
|
391
395
|
/// balance. The adapter's own return value is skipped: it is the counter Centrifuge said
|
|
392
396
|
/// it would pay out, and the band and the events have to carry what arrived.
|
|
397
|
+
/// @custom:oz-upgrades-unsafe-allow-reachable delegatecall
|
|
393
398
|
function _claimMeasuredAssets(address adapter, bytes memory data) private returns (uint256 assets) {
|
|
394
399
|
IERC20 assetToken = IERC20(_assetToken);
|
|
395
400
|
uint256 before = assetToken.balanceOf(address(this));
|
|
@@ -427,6 +432,7 @@ contract YieldGroupCentrifuge is YieldGroupBase, NavGuard, IYieldGroupCentrifuge
|
|
|
427
432
|
/// shares from the group's balance into `pendingRedeemRequest`, both inside this resource.
|
|
428
433
|
/// Undoing the request therefore has nothing to undo. What moves the band is the CLAIM, in
|
|
429
434
|
/// {_claimRedeem}, since that is where assets actually leave the resource.
|
|
435
|
+
/// @custom:oz-upgrades-unsafe-allow-reachable delegatecall
|
|
430
436
|
function _claimCancelRedeem(address resource, address adapter) private returns (uint256 shares) {
|
|
431
437
|
bytes memory ret =
|
|
432
438
|
adapter.functionDelegateCall(abi.encodeCall(IAdapterCentrifuge.claimCancelRedeem, (resource)));
|
|
@@ -624,6 +624,7 @@ abstract contract YieldGroupBase is ReentrancyGuardUpgradeable, YieldGroupBaseSt
|
|
|
624
624
|
// solhint-disable-next-line no-empty-blocks
|
|
625
625
|
function _onResourceRemoved(address resource) internal virtual { }
|
|
626
626
|
|
|
627
|
+
/// @custom:oz-upgrades-unsafe-allow-reachable delegatecall
|
|
627
628
|
function _dispatchDeposit(address adapter, address resource, uint256 amount) internal virtual {
|
|
628
629
|
adapter.functionDelegateCall(abi.encodeCall(IResourceAdapter.deposit, (resource, amount)));
|
|
629
630
|
emit DepositRouted(resource, amount);
|
|
@@ -647,6 +648,7 @@ abstract contract YieldGroupBase is ReentrancyGuardUpgradeable, YieldGroupBaseSt
|
|
|
647
648
|
* @param amount Underlying units to deliver to `to` (exact).
|
|
648
649
|
* @param to Recipient of the underlying.
|
|
649
650
|
* @return received Underlying units actually delivered to `to`, measured by balance delta.
|
|
651
|
+
* @custom:oz-upgrades-unsafe-allow-reachable delegatecall
|
|
650
652
|
*/
|
|
651
653
|
function _dispatchWithdraw(address adapter, address resource, uint256 amount, address to)
|
|
652
654
|
internal
|