Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ abstract contract HyperdriveDeployerCoordinator is
/// @param _deployConfig The deploy configuration of the Hyperdrive pool.
/// @param _extraData The extra data that contains the pool and sweep targets.
/// @param _salt The create2 salt used to deploy Hyperdrive.
/// @return The address of the newly deployed ERC4626Hyperdrive Instance.
/// @return The address of the newly deployed Hyperdrive instance.
function deploy(
bytes32 _deploymentId,
IHyperdrive.PoolDeployConfig memory _deployConfig,
Expand Down
30 changes: 15 additions & 15 deletions contracts/src/deployers/erc4626/ERC4626HyperdriveCoreDeployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,33 @@ contract ERC4626HyperdriveCoreDeployer is IHyperdriveCoreDeployer {
/// @notice Deploys a Hyperdrive instance with the given parameters.
/// @param _config The configuration of the Hyperdrive pool.
/// @param _extraData The extra data that contains the ERC4626 vault.
/// @param target0 The target0 address.
/// @param target1 The target1 address.
/// @param target2 The target2 address.
/// @param target3 The target3 address.
/// @param target4 The target4 address.
/// @param _target0 The target0 address.
/// @param _target1 The target1 address.
/// @param _target2 The target2 address.
/// @param _target3 The target3 address.
/// @param _target4 The target4 address.
/// @param _salt The create2 salt used in the deployment.
/// @return The address of the newly deployed ERC4626Hyperdrive instance.
function deploy(
IHyperdrive.PoolConfig memory _config,
bytes memory _extraData,
address target0,
address target1,
address target2,
address target3,
address target4,
address _target0,
address _target1,
address _target2,
address _target3,
address _target4,
bytes32 _salt
) external returns (address) {
address vault = abi.decode(_extraData, (address));
return (
address(
new ERC4626Hyperdrive{ salt: _salt }(
_config,
target0,
target1,
target2,
target3,
target4,
_target0,
_target1,
_target2,
_target3,
_target4,
IERC4626(vault)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ contract ERC4626Target0Deployer is IHyperdriveTargetDeployer {
/// @param _config The configuration of the Hyperdrive pool.
/// @param _extraData The extra data that contains the pool and sweep targets.
/// @param _salt The create2 salt used in the deployment.
/// @return The address of the newly deployed ERC4626Target0 Instance.
/// @return The address of the newly deployed ERC4626Target0 instance.
function deploy(
IHyperdrive.PoolConfig memory _config,
bytes memory _extraData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ contract ERC4626Target1Deployer is IHyperdriveTargetDeployer {
/// @param _config The configuration of the Hyperdrive pool.
/// @param _extraData The extra data that contains the pool and sweep targets.
/// @param _salt The create2 salt used in the deployment.
/// @return The address of the newly deployed ERC4626Target1 Instance.
/// @return The address of the newly deployed ERC4626Target1 instance.
function deploy(
IHyperdrive.PoolConfig memory _config,
bytes memory _extraData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ contract ERC4626Target2Deployer is IHyperdriveTargetDeployer {
/// @param _config The configuration of the Hyperdrive pool.
/// @param _extraData The extra data that contains the pool and sweep targets.
/// @param _salt The create2 salt used in the deployment.
/// @return The address of the newly deployed ERC4626Target2 Instance.
/// @return The address of the newly deployed ERC4626Target2 instance.
function deploy(
IHyperdrive.PoolConfig memory _config,
bytes memory _extraData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ contract ERC4626Target3Deployer is IHyperdriveTargetDeployer {
/// @param _config The configuration of the Hyperdrive pool.
/// @param _extraData The extra data that contains the pool and sweep targets.
/// @param _salt The create2 salt used in the deployment.
/// @return The address of the newly deployed ERC4626Target3 Instance.
/// @return The address of the newly deployed ERC4626Target3 instance.
function deploy(
IHyperdrive.PoolConfig memory _config,
bytes memory _extraData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ contract ERC4626Target4Deployer is IHyperdriveTargetDeployer {
/// @param _config The configuration of the Hyperdrive pool.
/// @param _extraData The extra data that contains the pool and sweep targets.
/// @param _salt The create2 salt used in the deployment.
/// @return The address of the newly deployed ERC4626Target4 Instance.
/// @return The address of the newly deployed ERC4626Target4 instance.
function deploy(
IHyperdrive.PoolConfig memory _config,
bytes memory _extraData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ contract StETHHyperdriveCoreDeployer is IHyperdriveCoreDeployer {
/// @param target3 The target3 address.
/// @param target4 The target4 address.
/// @param _salt The create2 salt used in the deployment.
/// @return The address of the newly deployed StETHHyperdrive Instance.
/// @return The address of the newly deployed StETHHyperdrive instance.
function deploy(
IHyperdrive.PoolConfig memory _config,
bytes memory, // unused extra data
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/deployers/steth/StETHTarget0Deployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ contract StETHTarget0Deployer is IHyperdriveTargetDeployer {
/// @notice Deploys a target0 instance with the given parameters.
/// @param _config The configuration of the Hyperdrive pool.
/// @param _salt The create2 salt used in the deployment.
/// @return The address of the newly deployed StETHTarget0 Instance.
/// @return The address of the newly deployed StETHTarget0 instance.
function deploy(
IHyperdrive.PoolConfig memory _config,
bytes memory, // unused extra data
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/deployers/steth/StETHTarget1Deployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ contract StETHTarget1Deployer is IHyperdriveTargetDeployer {
/// @notice Deploys a target1 instance with the given parameters.
/// @param _config The configuration of the Hyperdrive pool.
/// @param _salt The create2 salt used in the deployment.
/// @return The address of the newly deployed StETHTarget1 Instance.
/// @return The address of the newly deployed StETHTarget1 instance.
function deploy(
IHyperdrive.PoolConfig memory _config,
bytes memory, // unused extra data
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/deployers/steth/StETHTarget2Deployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ contract StETHTarget2Deployer is IHyperdriveTargetDeployer {
/// @notice Deploys a target2 instance with the given parameters.
/// @param _config The configuration of the Hyperdrive pool.
/// @param _salt The create2 salt used in the deployment.
/// @return The address of the newly deployed StETHTarget2 Instance.
/// @return The address of the newly deployed StETHTarget2 instance.
function deploy(
IHyperdrive.PoolConfig memory _config,
bytes memory, // unused extra data
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/deployers/steth/StETHTarget3Deployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ contract StETHTarget3Deployer is IHyperdriveTargetDeployer {
/// @notice Deploys a target3 instance with the given parameters.
/// @param _config The configuration of the Hyperdrive pool.
/// @param _salt The create2 salt used in the deployment.
/// @return The address of the newly deployed StETHTarget3 Instance.
/// @return The address of the newly deployed StETHTarget3 instance.
function deploy(
IHyperdrive.PoolConfig memory _config,
bytes memory, // unused extra data
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/deployers/steth/StETHTarget4Deployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ contract StETHTarget4Deployer is IHyperdriveTargetDeployer {
/// @notice Deploys a target4 instance with the given parameters.
/// @param _config The configuration of the Hyperdrive pool.
/// @param _salt The create2 salt used in the deployment.
/// @return The address of the newly deployed StETHTarget4 Instance.
/// @return The address of the newly deployed StETHTarget4 instance.
function deploy(
IHyperdrive.PoolConfig memory _config,
bytes memory, // unused extra data
Expand Down
50 changes: 21 additions & 29 deletions contracts/src/external/Hyperdrive.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pragma solidity 0.8.20;
import { HyperdriveTarget0 } from "../external/HyperdriveTarget0.sol";
import { IHyperdrive } from "../interfaces/IHyperdrive.sol";
import { IHyperdriveCore } from "../interfaces/IHyperdriveCore.sol";
import { IMultiTokenCore } from "../interfaces/IMultiTokenCore.sol";
import { HyperdriveAdmin } from "../internal/HyperdriveAdmin.sol";
import { HyperdriveBase } from "../internal/HyperdriveBase.sol";
import { HyperdriveCheckpoint } from "../internal/HyperdriveCheckpoint.sol";
Expand Down Expand Up @@ -167,7 +168,7 @@ abstract contract Hyperdrive is

/// Longs ///

/// @notice Opens a long position.
/// @inheritdoc IHyperdriveCore
function openLong(
uint256,
uint256,
Expand All @@ -177,7 +178,7 @@ abstract contract Hyperdrive is
_delegate(target3);
}

/// @notice Closes a long position with a specified maturity time.
/// @inheritdoc IHyperdriveCore
function closeLong(
uint256,
uint256,
Expand All @@ -189,7 +190,7 @@ abstract contract Hyperdrive is

/// Shorts ///

/// @notice Opens a short position.
/// @inheritdoc IHyperdriveCore
function openShort(
uint256,
uint256,
Expand All @@ -199,7 +200,7 @@ abstract contract Hyperdrive is
_delegate(target4);
}

/// @notice Closes a short position with a specified maturity time.
/// @inheritdoc IHyperdriveCore
function closeShort(
uint256,
uint256,
Expand All @@ -211,7 +212,7 @@ abstract contract Hyperdrive is

/// LPs ///

/// @notice Allows the first LP to initialize the market with a target APR.
/// @inheritdoc IHyperdriveCore
function initialize(
uint256,
uint256,
Expand All @@ -220,7 +221,7 @@ abstract contract Hyperdrive is
_delegate(target1);
}

/// @notice Allows LPs to supply liquidity for LP shares.
/// @inheritdoc IHyperdriveCore
function addLiquidity(
uint256,
uint256,
Expand All @@ -231,7 +232,7 @@ abstract contract Hyperdrive is
_delegate(target1);
}

/// @notice Allows an LP to burn shares and withdraw from the pool.
/// @inheritdoc IHyperdriveCore
function removeLiquidity(
uint256,
uint256,
Expand All @@ -240,10 +241,7 @@ abstract contract Hyperdrive is
_delegate(target1);
}

/// @notice Redeems withdrawal shares by giving the LP a pro-rata amount of
/// the withdrawal pool's proceeds. This function redeems the
/// maximum amount of the specified withdrawal shares given the
/// amount of withdrawal shares ready to withdraw.
/// @inheritdoc IHyperdriveCore
function redeemWithdrawalShares(
uint256,
uint256,
Expand All @@ -254,45 +252,43 @@ abstract contract Hyperdrive is

/// Checkpoints ///

/// @notice Allows anyone to mint a new checkpoint.
/// @inheritdoc IHyperdriveCore
function checkpoint(uint256) external {
_delegate(target2);
}

/// Admin ///

/// @notice This function collects the governance fees accrued by the pool.
/// @return proceeds The amount of base collected.
/// @inheritdoc IHyperdriveCore
function collectGovernanceFee(
IHyperdrive.Options calldata
) external returns (uint256) {
_delegate(target0);
}

/// @notice Allows an authorized address to pause this contract.
/// @inheritdoc IHyperdriveCore
function pause(bool) external {
_delegate(target0);
}

/// @notice Allows governance to change governance.
/// @inheritdoc IHyperdriveCore
function setGovernance(address) external {
_delegate(target0);
}

/// @notice Allows governance to change the pauser status of an address.
/// @inheritdoc IHyperdriveCore
function setPauser(address, bool) external {
_delegate(target0);
}

/// Token ///
/// MultiToken ///

/// @notice Transfers an amount of assets from the source to the destination.
/// @inheritdoc IMultiTokenCore
function transferFrom(uint256, address, address, uint256) external {
_delegate(target0);
}

/// @notice Permissioned transfer for the bridge to access, only callable by
/// the ERC20 linking bridge.
/// @inheritdoc IMultiTokenCore
function transferFromBridge(
uint256,
address,
Expand All @@ -303,24 +299,22 @@ abstract contract Hyperdrive is
_delegate(target0);
}

/// @notice Allows the compatibility linking contract to forward calls to
/// set asset approvals.
/// @inheritdoc IMultiTokenCore
function setApprovalBridge(uint256, address, uint256, address) external {
_delegate(target0);
}

/// @notice Allows a user to approve an operator to use all of their assets.
/// @inheritdoc IMultiTokenCore
function setApprovalForAll(address, bool) external {
_delegate(target0);
}

/// @notice Allows a user to set an approval for an individual asset with
/// specific amount.
/// @inheritdoc IMultiTokenCore
function setApproval(uint256, address, uint256) external {
_delegate(target0);
}

/// @notice Transfers several assets from one account to another
/// @inheritdoc IMultiTokenCore
function batchTransferFrom(
address,
address,
Expand All @@ -330,8 +324,6 @@ abstract contract Hyperdrive is
_delegate(target0);
}

/// MultiToken ///

/// @notice Allows a caller who is not the owner of an account to execute the
/// functionality of 'approve' for all assets with the owners signature.
/// @param owner The owner of the account which is having the new approval set.
Expand Down
17 changes: 9 additions & 8 deletions contracts/src/external/HyperdriveTarget0.sol
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ abstract contract HyperdriveTarget0 is

/// @notice Transfers an amount of assets from the source to the destination.
/// @param tokenID The token identifier.
/// @param from The address who's balance will be reduced.
/// @param to The address who's balance will be increased.
/// @param from The address whose balance will be reduced.
/// @param to The address whose balance will be increased.
/// @param amount The amount of token to move.
function transferFrom(
uint256 tokenID,
Expand All @@ -87,8 +87,8 @@ abstract contract HyperdriveTarget0 is
/// @notice Permissioned transfer for the bridge to access, only callable by
/// the ERC20 linking bridge.
/// @param tokenID The token identifier.
/// @param from The address who's balance will be reduced.
/// @param to The address who's balance will be increased.
/// @param from The address whose balance will be reduced.
/// @param to The address whose balance will be increased.
/// @param amount The amount of token to move.
/// @param caller The msg.sender from the bridge.
function transferFromBridge(
Expand Down Expand Up @@ -145,8 +145,8 @@ abstract contract HyperdriveTarget0 is
}

/// @notice Transfers several assets from one account to another.
/// @param from the source account.
/// @param to the destination account.
/// @param from The source account.
/// @param to The destination account.
/// @param ids The array of token ids of the asset to transfer.
/// @param values The amount of each token to transfer.
function batchTransferFrom(
Expand All @@ -159,7 +159,8 @@ abstract contract HyperdriveTarget0 is
}

/// @notice Allows a caller who is not the owner of an account to execute the
/// functionality of 'approve' for all assets with the owners signature.
/// functionality of 'approve' for all assets with the owner's
/// signature.
/// @param domainSeparator The EIP712 domain separator of the contract.
/// @param permitTypeHash The EIP712 domain separator of the contract.
/// @param owner The owner of the account which is having the new approval set.
Expand Down Expand Up @@ -272,7 +273,7 @@ abstract contract HyperdriveTarget0 is

/// @notice Gets info about the pool's reserves and other state that is
/// important to evaluate potential trades.
/// @return The PoolInfo struct.
/// @return The pool info.
function getPoolInfo() external view returns (IHyperdrive.PoolInfo memory) {
uint256 vaultSharePrice = _pricePerVaultShare();
uint256 lpTotalSupply = _totalSupply[AssetId._LP_ASSET_ID] +
Expand Down
Loading