generated from sushiswap/hardhat-foundation
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e7161fc
commit a2e857f
Showing
6 changed files
with
228 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
pragma solidity 0.8.11; | ||
|
||
/// @notice Minimal BentoBox vault interface. | ||
/// @dev `token` is aliased as `address` from `IERC20` for simplicity. | ||
interface IBentoBoxMinimal { | ||
/// @notice Balance per ERC-20 token per account in shares. | ||
function balanceOf(address, address) external view returns (uint256); | ||
|
||
/// @dev Helper function to represent an `amount` of `token` in shares. | ||
/// @param token The ERC-20 token. | ||
/// @param amount The `token` amount. | ||
/// @param roundUp If the result `share` should be rounded up. | ||
/// @return share The token amount represented in shares. | ||
function toShare( | ||
address token, | ||
uint256 amount, | ||
bool roundUp | ||
) external view returns (uint256 share); | ||
|
||
/// @dev Helper function to represent shares back into the `token` amount. | ||
/// @param token The ERC-20 token. | ||
/// @param share The amount of shares. | ||
/// @param roundUp If the result should be rounded up. | ||
/// @return amount The share amount back into native representation. | ||
function toAmount( | ||
address token, | ||
uint256 share, | ||
bool roundUp | ||
) external view returns (uint256 amount); | ||
|
||
/// @notice Registers this contract so that users can approve it for BentoBox. | ||
function registerProtocol() external; | ||
|
||
/// @notice Deposit an amount of `token` represented in either `amount` or `share`. | ||
/// @param token_ The ERC-20 token to deposit. | ||
/// @param from which account to pull the tokens. | ||
/// @param to which account to push the tokens. | ||
/// @param amount Token amount in native representation to deposit. | ||
/// @param share Token amount represented in shares to deposit. Takes precedence over `amount`. | ||
/// @return amountOut The amount deposited. | ||
/// @return shareOut The deposited amount represented in shares. | ||
function deposit( | ||
address token_, | ||
address from, | ||
address to, | ||
uint256 amount, | ||
uint256 share | ||
) external payable returns (uint256 amountOut, uint256 shareOut); | ||
|
||
/// @notice Withdraws an amount of `token` from a user account. | ||
/// @param token_ The ERC-20 token to withdraw. | ||
/// @param from which user to pull the tokens. | ||
/// @param to which user to push the tokens. | ||
/// @param amount of tokens. Either one of `amount` or `share` needs to be supplied. | ||
/// @param share Like above, but `share` takes precedence over `amount`. | ||
function withdraw( | ||
address token_, | ||
address from, | ||
address to, | ||
uint256 amount, | ||
uint256 share | ||
) external returns (uint256 amountOut, uint256 shareOut); | ||
|
||
/// @notice Transfer shares from a user account to another one. | ||
/// @param token The ERC-20 token to transfer. | ||
/// @param from which user to pull the tokens. | ||
/// @param to which user to push the tokens. | ||
/// @param share The amount of `token` in shares. | ||
function transfer( | ||
address token, | ||
address from, | ||
address to, | ||
uint256 share | ||
) external; | ||
|
||
function setMasterContractApproval( | ||
address user, | ||
address masterContract, | ||
bool approved, | ||
uint8 v, | ||
bytes32 r, | ||
bytes32 s | ||
) external; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
|
||
pragma solidity 0.8.11; | ||
|
||
interface IStargateReceiver { | ||
function sgReceive( | ||
uint16 _chainId, | ||
bytes memory _srcAddress, | ||
uint256 _nonce, | ||
address _token, | ||
uint256 amountLD, | ||
bytes memory payload | ||
) external; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
|
||
pragma solidity 0.8.11; | ||
|
||
interface IStargateRouter { | ||
|
||
struct lzTxObj { | ||
uint256 dstGasForCall; | ||
uint256 dstNativeAmount; | ||
bytes dstNativeAddr; | ||
} | ||
|
||
function swap( | ||
uint16 _dstChainId, | ||
uint256 _srcPoolId, | ||
uint256 _dstPoolId, | ||
address payable _refundAddress, | ||
uint256 _amountLD, | ||
uint256 _minAmountLD, | ||
lzTxObj memory _lzTxParams, | ||
bytes calldata _to, | ||
bytes calldata _payload | ||
) external payable; | ||
|
||
function quoteLayerZeroFee( | ||
uint16 _dstChainId, | ||
uint8 _functionType, | ||
bytes calldata _toAddress, | ||
bytes calldata _transferAndCallPayload, | ||
lzTxObj memory _lzTxParams | ||
) external view returns (uint256, uint256); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters