Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion contracts/account-service/HederaAccountService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ abstract contract HederaAccountService {
}

/// Determines if the signature is valid for the given message hash and account.
/// It is assumed that the signature is composed of a single EDCSA or ED25519 key.
/// It is assumed that the signature is composed of a single ECDSA or ED25519 key.
/// @param account The account to check the signature against
/// @param messageHash The hash of the message to check the signature against
/// @param signature The signature to check
Expand Down
2 changes: 1 addition & 1 deletion contracts/account-service/IHRC632.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ interface IHRC632 {
function isValidAlias(address addr) external returns (bool response);

/// Determines if the signature is valid for the given message hash and account.
/// It is assumed that the signature is composed of a single EDCSA or ED25519 key.
/// It is assumed that the signature is composed of a single ECDSA or ED25519 key.
/// @param account The account to check the signature against.
/// @param messageHash The hash of the message to check the signature against.
/// @param signature The signature to check.
Expand Down
2 changes: 1 addition & 1 deletion contracts/account-service/IHederaAccountService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ interface IHederaAccountService {
function isValidAlias(address addr) external returns (int64 responseCode, bool response);

/// Determines if the signature is valid for the given message hash and account.
/// It is assumed that the signature is composed of a single EDCSA or ED25519 key.
/// It is assumed that the signature is composed of a single ECDSA or ED25519 key.
/// @param account The account to check the signature against.
/// @param messageHash The hash of the message to check the signature against.
/// @param signature The signature to check.
Expand Down
10 changes: 5 additions & 5 deletions contracts/exchange-rate/ExchangeRateMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ contract ExchangeRateMock is SelfFunding {
event TinyBars(uint256 tinybars);
event TinyCents(uint256 tinycents);

function convertTinycentsToTinybars(uint256 tineycents) external returns (uint256 tinybars) {
tinybars = tinycentsToTinybars(tineycents);
function convertTinycentsToTinybars(uint256 tinycents) external returns (uint256 tinybars) {
tinybars = tinycentsToTinybars(tinycents);
emit TinyBars(tinybars);
}

function convertTinybarsToTinycents(uint256 tinybars) external returns (uint256 tineycents) {
tineycents = tinybarsToTinycents(tinybars);
emit TinyCents(tineycents);
function convertTinybarsToTinycents(uint256 tinybars) external returns (uint256 tinycents) {
tinycents = tinybarsToTinycents(tinybars);
emit TinyCents(tinycents);
}
}
2 changes: 1 addition & 1 deletion contracts/extensions/hrc-904/Airdrop.sol
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ contract Airdrop is HederaTokenService {
// @param receiver The address receiving all NFTs
// @param serials Array of serial numbers corresponding to each NFT
// @return responseCode The response code from the airdrop operation (22 = success)
function multipleNftAirdrop(address[] memory nfts, address sender, address receiver, int64[] memory serials) public returns (int64 responseCode) {
function multipleNftAirdrop(address[] memory nfts, address sender, address receiver, int64[] memory serials) public payable returns (int64 responseCode) {
uint256 length = nfts.length;
IHederaTokenService.TokenTransferList[] memory tokenTransfers = new IHederaTokenService.TokenTransferList[](length);
for (uint256 i = 0; i < length; i++)
Expand Down
2 changes: 1 addition & 1 deletion contracts/extensions/ihrc-1215/HRC1215Contract.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.4.9 <0.9.0;

import "../../schedule-service/HederaScheduleService.sol";
Expand Down
1 change: 0 additions & 1 deletion contracts/extensions/ihrc-755/HRC755Contract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
pragma solidity >=0.4.9 <0.9.0;

import "../../schedule-service/HederaScheduleService.sol";
import "../../token-service/HederaTokenService.sol";

pragma experimental ABIEncoderV2;

Expand Down
3 changes: 1 addition & 2 deletions contracts/extensions/token-create/TokenCreateContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ pragma solidity >=0.5.0 <0.9.0;
pragma experimental ABIEncoderV2;

import "../../token-service/HederaTokenService.sol";
import "../../token-service/ExpiryHelper.sol";
import "../../token-service/KeyHelper.sol";

contract TokenCreateContract is HederaTokenService, ExpiryHelper, KeyHelper {
contract TokenCreateContract is HederaTokenService, KeyHelper {

string name = "tokenName";
string symbol = "tokenSymbol";
Expand Down
3 changes: 1 addition & 2 deletions contracts/extensions/token-create/TokenCreateCustom.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ pragma solidity >=0.5.0 <0.9.0;
pragma experimental ABIEncoderV2;

import "../../token-service/HederaTokenService.sol";
import "../../token-service/ExpiryHelper.sol";
import "../../token-service/KeyHelper.sol";
import "../../token-service/FeeHelper.sol";

contract TokenCreateCustomContract is HederaTokenService, ExpiryHelper, KeyHelper, FeeHelper {
contract TokenCreateCustomContract is HederaTokenService, KeyHelper, FeeHelper {
bool finiteTotalSupplyType = true;

event ResponseCode(int responseCode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ pragma solidity >=0.5.0 <0.9.0;
pragma experimental ABIEncoderV2;

import "../../token-service/HederaTokenService.sol";
import "../../token-service/ExpiryHelper.sol";
import "../../token-service/KeyHelper.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

contract TokenManagementContract is HederaTokenService, ExpiryHelper, KeyHelper {
contract TokenManagementContract is HederaTokenService {

event ResponseCode(int responseCode);
event PausedToken(bool paused);
Expand Down
4 changes: 1 addition & 3 deletions contracts/extensions/token-query/TokenQueryContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ pragma solidity >=0.5.0 <0.9.0;
pragma experimental ABIEncoderV2;

import "../../token-service/HederaTokenService.sol";
import "../../token-service/ExpiryHelper.sol";
import "../../token-service/KeyHelper.sol";

contract TokenQueryContract is HederaTokenService, ExpiryHelper, KeyHelper {
contract TokenQueryContract is HederaTokenService {

event ResponseCode(int responseCode);
event AllowanceValue(uint256 amount);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ pragma solidity >=0.5.0 <0.9.0;
pragma experimental ABIEncoderV2;

import "../../token-service/HederaTokenService.sol";
import "../../token-service/ExpiryHelper.sol";
import "../../token-service/KeyHelper.sol";

contract TokenTransferContract is HederaTokenService, ExpiryHelper, KeyHelper {
contract TokenTransferContract is HederaTokenService {

event ResponseCode(int responseCode);

Expand Down
6 changes: 1 addition & 5 deletions contracts/mocks/InternalCallee.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

contract Sample {
function selfDestructSample() external {
selfdestruct(payable(msg.sender));
}
}
import "./Sample.sol";

contract InternalCallee {
uint public calledTimes = 0;
Expand Down
5 changes: 3 additions & 2 deletions contracts/native/EcrecoverCaller.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ contract EcrecoverCaller {
return success;
}

function send0x1() external payable {
function send0x1() external payable returns (bool) {
address payable target = payable(accountZeroZeroOne);
target.transfer(msg.value);
bool success = target.send(msg.value);
return success;
}

function transfer0x1() external payable {
Expand Down
4 changes: 2 additions & 2 deletions contracts/prng/PrngSystemContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ pragma solidity >=0.5.0 <0.9.0;

import "./IPrngSystemContract.sol";

contract PrngSystemContract {
contract PrngSystemContract is IPrngSystemContract {
event PseudoRandomSeed(bytes32 seedBytes);

// Prng system contract address with ContractID 0.0.361
address constant PRECOMPILE_ADDRESS = address(0x169);

function getPseudorandomSeed() external returns (bytes32 seedBytes) {
function getPseudorandomSeed() external override returns (bytes32 seedBytes) {
(bool success, bytes memory result) = PRECOMPILE_ADDRESS.call(
abi.encodeWithSelector(IPrngSystemContract.getPseudorandomSeed.selector));
require(success, "PRNG system call failed");
Expand Down
2 changes: 1 addition & 1 deletion contracts/schedule-service/HederaScheduleService.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.4.9 <0.9.0;
pragma solidity >=0.5.0 <0.9.0;
pragma experimental ABIEncoderV2;

import "../common/HederaResponseCodes.sol";
Expand Down
12 changes: 0 additions & 12 deletions contracts/token-service-v2/HederaTokenService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ abstract contract HederaTokenService {

/// Retrieves fungible specific token info for a fungible token
/// @param token The ID of the token as a solidity address
/// @dev This function reverts if the call is not successful
function getFungibleTokenInfo(address token) internal returns (int responseCode, IHederaTokenService.FungibleTokenInfo memory tokenInfo) {
(bool success, bytes memory result) = precompileAddress.call(
abi.encodeWithSelector(IHederaTokenService.getFungibleTokenInfo.selector, token));
Expand All @@ -223,7 +222,6 @@ abstract contract HederaTokenService {

/// Retrieves general token info for a given token
/// @param token The ID of the token as a solidity address
/// @dev This function reverts if the call is not successful
function getTokenInfo(address token) internal returns (int responseCode, IHederaTokenService.TokenInfo memory tokenInfo) {
(bool success, bytes memory result) = precompileAddress.call(
abi.encodeWithSelector(IHederaTokenService.getTokenInfo.selector, token));
Expand All @@ -233,7 +231,6 @@ abstract contract HederaTokenService {

/// Retrieves non-fungible specific token info for a given NFT
/// @param token The ID of the token as a solidity address
/// @dev This function reverts if the call is not successful
function getNonFungibleTokenInfo(address token, int64 serialNumber) internal returns (int responseCode, IHederaTokenService.NonFungibleTokenInfo memory tokenInfo) {
(bool success, bytes memory result) = precompileAddress.call(
abi.encodeWithSelector(IHederaTokenService.getNonFungibleTokenInfo.selector, token, serialNumber));
Expand All @@ -247,7 +244,6 @@ abstract contract HederaTokenService {
/// @return fixedFees Set of fixed fees for `token`
/// @return fractionalFees Set of fractional fees for `token`
/// @return royaltyFees Set of royalty fees for `token`
/// @dev This function reverts if the call is not successful
function getTokenCustomFees(address token) internal returns (int64 responseCode,
IHederaTokenService.FixedFee[] memory fixedFees,
IHederaTokenService.FractionalFee[] memory fractionalFees,
Expand Down Expand Up @@ -359,7 +355,6 @@ abstract contract HederaTokenService {
/// @param account The account address associated with the token
/// @return responseCode The response code for the status of the request. SUCCESS is 22.
/// @return frozen True if `account` is frozen for `token`
/// @dev This function reverts if the call is not successful
function isFrozen(address token, address account) internal returns (int64 responseCode, bool frozen){
(bool success, bytes memory result) = precompileAddress.call(
abi.encodeWithSelector(IHederaTokenService.isFrozen.selector, token, account));
Expand All @@ -371,7 +366,6 @@ abstract contract HederaTokenService {
/// @param account The account address associated with the token
/// @return responseCode The response code for the status of the request. SUCCESS is 22.
/// @return kycGranted True if `account` has kyc granted for `token`
/// @dev This function reverts if the call is not successful
function isKyc(address token, address account) internal returns (int64 responseCode, bool kycGranted){
(bool success, bytes memory result) = precompileAddress.call(
abi.encodeWithSelector(IHederaTokenService.isKyc.selector, token, account));
Expand Down Expand Up @@ -454,7 +448,6 @@ abstract contract HederaTokenService {
/// @param token The token address to check
/// @return responseCode The response code for the status of the request. SUCCESS is 22.
/// @return defaultFreezeStatus True if `token` default freeze status is frozen.
/// @dev This function reverts if the call is not successful
function getTokenDefaultFreezeStatus(address token) internal returns (int responseCode, bool defaultFreezeStatus) {
(bool success, bytes memory result) = precompileAddress.call(
abi.encodeWithSelector(IHederaTokenService.getTokenDefaultFreezeStatus.selector, token));
Expand All @@ -465,7 +458,6 @@ abstract contract HederaTokenService {
/// @param token The token address to check
/// @return responseCode The response code for the status of the request. SUCCESS is 22.
/// @return defaultKycStatus True if `token` default kyc status is KycNotApplicable and false if Revoked.
/// @dev This function reverts if the call is not successful
function getTokenDefaultKycStatus(address token) internal returns (int responseCode, bool defaultKycStatus) {
(bool success, bytes memory result) = precompileAddress.call(
abi.encodeWithSelector(IHederaTokenService.getTokenDefaultKycStatus.selector, token));
Expand Down Expand Up @@ -606,7 +598,6 @@ abstract contract HederaTokenService {
/// @param keyType The keyType of the desired KeyValue
/// @return responseCode The response code for the status of the request. SUCCESS is 22.
/// @return key KeyValue info for key of type `keyType`
/// @dev This function reverts if the call is not successful
function getTokenKey(address token, uint keyType)
internal returns (int64 responseCode, IHederaTokenService.KeyValue memory key){
(bool success, bytes memory result) = precompileAddress.call(
Expand All @@ -620,7 +611,6 @@ abstract contract HederaTokenService {
/// @param token The token address
/// @return responseCode The response code for the status of the request. SUCCESS is 22.
/// @return isTokenFlag True if valid token found for the given address
/// @dev This function reverts if the call is not successful
function isToken(address token) internal returns (int64 responseCode, bool isTokenFlag) {
(bool success, bytes memory result) = precompileAddress.call(
abi.encodeWithSelector(IHederaTokenService.isToken.selector, token));
Expand All @@ -631,7 +621,6 @@ abstract contract HederaTokenService {
/// @param token The token address
/// @return responseCode The response code for the status of the request. SUCCESS is 22.
/// @return tokenType the token type. 0 is FUNGIBLE_COMMON, 1 is NON_FUNGIBLE_UNIQUE, -1 is UNRECOGNIZED
/// @dev This function reverts if the call is not successful
function getTokenType(address token) internal returns (int64 responseCode, int32 tokenType) {
(bool success, bytes memory result) = precompileAddress.call(
abi.encodeWithSelector(IHederaTokenService.getTokenType.selector, token));
Expand All @@ -642,7 +631,6 @@ abstract contract HederaTokenService {
/// @param token The token address
/// @return responseCode The response code for the status of the request. SUCCESS is 22.
/// @return expiryInfo The expiry info of the token
/// @dev This function reverts if the call is not successful
function getTokenExpiryInfo(address token) internal returns (int responseCode, IHederaTokenService.Expiry memory expiryInfo){
(bool success, bytes memory result) = precompileAddress.call(
abi.encodeWithSelector(IHederaTokenService.getTokenExpiryInfo.selector, token));
Expand Down
6 changes: 3 additions & 3 deletions contracts/token-service-v2/KeyHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ abstract contract KeyHelper {
CONTRACT_ID,
ED25519,
SECP256K1,
DELEGETABLE_CONTRACT_ID
DELEGATABLE_CONTRACT_ID
}

constructor() {
Expand Down Expand Up @@ -112,15 +112,15 @@ abstract contract KeyHelper {
keyValue.ed25519 = key;
} else if (keyValueType == KeyValueType.SECP256K1) {
keyValue.ECDSA_secp256k1 = key;
} else if (keyValueType == KeyValueType.DELEGETABLE_CONTRACT_ID) {
} else if (keyValueType == KeyValueType.DELEGATABLE_CONTRACT_ID) {
keyValue.delegatableContractId = supplyContract;
}
}

function getKeyValueType(KeyValueType keyValueType, address keyAddress) internal pure returns (IHederaTokenService.KeyValue memory keyValue) {
if (keyValueType == KeyValueType.CONTRACT_ID) {
keyValue.contractId = keyAddress;
} else if (keyValueType == KeyValueType.DELEGETABLE_CONTRACT_ID) {
} else if (keyValueType == KeyValueType.DELEGATABLE_CONTRACT_ID) {
keyValue.delegatableContractId = keyAddress;
}
}
Expand Down
10 changes: 5 additions & 5 deletions contracts/token-service/AtomicHTS.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ contract AtomicHTS is HederaTokenService {
*
* @notice because .approve() can only grant allowances to spender on behalf of the caller, and in this case
* `this contract` is the caller who makes transactions to the `precompile contract`. With the same reason,
* .transferFrom() will transfer the tokens from token owner to the receipient by the spender (this contract)
* .transferFrom() will transfer the tokens from token owner to the recipient by the spender (this contract)
* on behalf of the token owner. Therefore, the spender in this particular case will also be the sender whose balance
* will be deducted by the .transferFrom() method.
*/
function batchApproveAssociateGrantKYCTransferFrom(address token, address owner, address receipient, int64 transferAmount, uint256 allowance) external {
function batchApproveAssociateGrantKYCTransferFrom(address token, address owner, address recipient, int64 transferAmount, uint256 allowance) external {

/// top up the spender with initial fund
/// @notice it is necessary for the spender to be associated and granted token KYC to receive fund.
Expand All @@ -77,17 +77,17 @@ contract AtomicHTS is HederaTokenService {
(int approveResponseCode) = HederaTokenService.approve(token, spender, allowance);
require(approveResponseCode == HederaResponseCodes.SUCCESS, "Failed to grant token allowance.");

(int associateResponseCode) = HederaTokenService.associateToken(receipient, token);
(int associateResponseCode) = HederaTokenService.associateToken(recipient, token);
require(
associateResponseCode == HederaResponseCodes.SUCCESS ||
associateResponseCode == HederaResponseCodes.TOKEN_ALREADY_ASSOCIATED_TO_ACCOUNT,
"Failed to associate token."
);

(int grantKYCResponseCode) = HederaTokenService.grantTokenKyc(token, receipient);
(int grantKYCResponseCode) = HederaTokenService.grantTokenKyc(token, recipient);
require(grantKYCResponseCode == HederaResponseCodes.SUCCESS, "Failed to grant token KYC.");

(int transferFromResponseCode) = this.transferFrom(token, spender, receipient, allowance);
(int transferFromResponseCode) = this.transferFrom(token, spender, recipient, allowance);
require(transferFromResponseCode == HederaResponseCodes.SUCCESS, "Failed to transfer token.");

emit BatchApproveAssociateGrantKYCTransferFrom(transferTokenResponseCode, approveResponseCode, associateResponseCode, grantKYCResponseCode, transferFromResponseCode);
Expand Down
Loading
Loading