-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from web3-nomad/feature/erc4626
Vault contracts with utils file for interactions with HTS in tests
- Loading branch information
Showing
37 changed files
with
4,097 additions
and
2,829 deletions.
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
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,23 @@ | ||
//SPDX-License-Identifier: Unlicense | ||
pragma solidity ^0.8.0; | ||
|
||
interface IERC20 { | ||
function totalSupply() external view returns (uint); | ||
|
||
function balanceOf(address account) external view returns (uint); | ||
|
||
function transfer(address recipient, uint amount) external returns (bool); | ||
|
||
function allowance(address owner, address spender) external view returns (uint); | ||
|
||
function approve(address spender, uint amount) external returns (bool); | ||
|
||
function transferFrom( | ||
address sender, | ||
address recipient, | ||
uint amount | ||
) external returns (bool); | ||
|
||
event Transfer(address indexed from, address indexed to, uint value); | ||
event Approval(address indexed owner, address indexed spender, uint value); | ||
} |
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,20 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
pragma solidity >=0.5.0 <0.9.0; | ||
pragma experimental ABIEncoderV2; | ||
|
||
import "./HederaTokenService.sol"; | ||
import "./FeeHelper.sol"; | ||
|
||
contract ExpiryHelper is FeeHelper { | ||
function createAutoRenewExpiry( | ||
address autoRenewAccount, | ||
uint32 autoRenewPeriod | ||
) internal view returns (IHederaTokenService.Expiry memory expiry) { | ||
expiry.autoRenewAccount = autoRenewAccount; | ||
expiry.autoRenewPeriod = autoRenewPeriod; | ||
} | ||
|
||
function createSecondExpiry(uint32 second) internal view returns (IHederaTokenService.Expiry memory expiry) { | ||
expiry.second = second; | ||
} | ||
} |
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,103 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
pragma solidity >=0.5.0 <0.9.0; | ||
pragma experimental ABIEncoderV2; | ||
|
||
import "./HederaTokenService.sol"; | ||
import "./HederaResponseCodes.sol"; | ||
import "./IHederaTokenService.sol"; | ||
import "./KeyHelper.sol"; | ||
|
||
contract FeeHelper is KeyHelper { | ||
function createFixedHbarFee( | ||
uint32 amount, | ||
address feeCollector | ||
) internal pure returns (IHederaTokenService.FixedFee memory fixedFee) { | ||
fixedFee.amount = amount; | ||
fixedFee.useHbarsForPayment = true; | ||
fixedFee.feeCollector = feeCollector; | ||
} | ||
|
||
function createFixedTokenFee( | ||
uint32 amount, | ||
address tokenId, | ||
address feeCollector | ||
) internal pure returns (IHederaTokenService.FixedFee memory fixedFee) { | ||
fixedFee.amount = amount; | ||
fixedFee.tokenId = tokenId; | ||
fixedFee.feeCollector = feeCollector; | ||
} | ||
|
||
function createFixedSelfDenominatedFee( | ||
uint32 amount, | ||
address feeCollector | ||
) internal pure returns (IHederaTokenService.FixedFee memory fixedFee) { | ||
fixedFee.amount = amount; | ||
fixedFee.useCurrentTokenForPayment = true; | ||
fixedFee.feeCollector = feeCollector; | ||
} | ||
|
||
function createFractionalFee( | ||
uint32 numerator, | ||
uint32 denominator, | ||
bool netOfTransfers, | ||
address feeCollector | ||
) internal pure returns (IHederaTokenService.FractionalFee memory fractionalFee) { | ||
fractionalFee.numerator = numerator; | ||
fractionalFee.denominator = denominator; | ||
fractionalFee.netOfTransfers = netOfTransfers; | ||
fractionalFee.feeCollector = feeCollector; | ||
} | ||
|
||
function createFractionalFeeWithMinAndMax( | ||
uint32 numerator, | ||
uint32 denominator, | ||
uint32 minimumAmount, | ||
uint32 maximumAmount, | ||
bool netOfTransfers, | ||
address feeCollector | ||
) internal pure returns (IHederaTokenService.FractionalFee memory fractionalFee) { | ||
fractionalFee.numerator = numerator; | ||
fractionalFee.denominator = denominator; | ||
fractionalFee.minimumAmount = minimumAmount; | ||
fractionalFee.maximumAmount = maximumAmount; | ||
fractionalFee.netOfTransfers = netOfTransfers; | ||
fractionalFee.feeCollector = feeCollector; | ||
} | ||
|
||
function createRoyaltyFeeWithoutFallback( | ||
uint32 numerator, | ||
uint32 denominator, | ||
address feeCollector | ||
) internal pure returns (IHederaTokenService.RoyaltyFee memory royaltyFee) { | ||
royaltyFee.numerator = numerator; | ||
royaltyFee.denominator = denominator; | ||
royaltyFee.feeCollector = feeCollector; | ||
} | ||
|
||
function createRoyaltyFeeWithHbarFallbackFee( | ||
uint32 numerator, | ||
uint32 denominator, | ||
uint32 amount, | ||
address feeCollector | ||
) internal pure returns (IHederaTokenService.RoyaltyFee memory royaltyFee) { | ||
royaltyFee.numerator = numerator; | ||
royaltyFee.denominator = denominator; | ||
royaltyFee.amount = amount; | ||
royaltyFee.useHbarsForPayment = true; | ||
royaltyFee.feeCollector = feeCollector; | ||
} | ||
|
||
function createRoyaltyFeeWithTokenDenominatedFallbackFee( | ||
uint32 numerator, | ||
uint32 denominator, | ||
uint32 amount, | ||
address tokenId, | ||
address feeCollector | ||
) internal pure returns (IHederaTokenService.RoyaltyFee memory royaltyFee) { | ||
royaltyFee.numerator = numerator; | ||
royaltyFee.denominator = denominator; | ||
royaltyFee.amount = amount; | ||
royaltyFee.tokenId = tokenId; | ||
royaltyFee.feeCollector = feeCollector; | ||
} | ||
} |
Oops, something went wrong.