Skip to content

Commit

Permalink
feat: added test coverage of CancelAirdrop.sol
Browse files Browse the repository at this point in the history
Signed-off-by: Simeon Nakov <[email protected]>
  • Loading branch information
simzzz committed Jan 17, 2025
1 parent 74c78d1 commit 519d86e
Show file tree
Hide file tree
Showing 6 changed files with 432 additions and 140 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"type": "int64[]"
}
],
"name": "cancelAirdrops",
"name": "cancelMultipleAirdrops",
"outputs": [
{
"internalType": "int64",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ contract CancelAirdrop is HederaTokenService {
// @param tokens Array of token addresses for the pending airdrops
// @param serials Array of serial numbers for NFT airdrops (use 0 for fungible tokens)
// @return responseCode The response code from the batch cancel operation (22 = success)
function cancelAirdrops(address[] memory senders, address[] memory receivers, address[] memory tokens, int64[] memory serials) public returns (int64 responseCode) {
function cancelMultipleAirdrops(address[] memory senders, address[] memory receivers, address[] memory tokens, int64[] memory serials) public returns (int64 responseCode) {
uint length = senders.length;
IHederaTokenService.PendingAirdrop[] memory pendingAirdrops = new IHederaTokenService.PendingAirdrop[](length);
for (uint i = 0; i < length; i++) {
Expand Down
10 changes: 10 additions & 0 deletions test/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,15 @@ const Contract = {
CancunOpcodes: 'CancunOpcodes',
KZGPointEvaluation: 'KZGPointEvaluation',
StateRegistry: 'StateRegistry',
Airdrop: 'Airdrop',
CancelAirdrop: 'CancelAirdrop',
};

const CALL_EXCEPTION = 'CALL_EXCEPTION';
const CONTRACT_REVERT_EXECUTED_CODE = 3;
const GAS_LIMIT_1_000_000 = { gasLimit: 1_000_000 };
const GAS_LIMIT_2_000_000 = { gasLimit: 2_000_000 };
const GAS_LIMIT_5_000_000 = { gasLimit: 5_000_000 };
const GAS_LIMIT_10_000_000 = { gasLimit: 10_000_000 };
const GAS_LIMIT_800000 = { gasLimit: 800000 };
const GAS_LIMIT_8000000 = { gasLimit: 8000000 };
Expand All @@ -222,6 +226,8 @@ const HOUR = 60 * MINUTE;
const DAY = 24 * HOUR;
const WEEK = 7 * DAY;
const GWEI = 1e9;
const HTS_SYSTEM_CONTRACT_ADDRESS = '0.0.359';
const HAS_SYSTEM_CONTRACT_ADDRESS = '0.0.362';

module.exports = {
Events,
Expand All @@ -230,6 +236,8 @@ module.exports = {
CALL_EXCEPTION,
CONTRACT_REVERT_EXECUTED_CODE,
GAS_LIMIT_1_000_000,
GAS_LIMIT_2_000_000,
GAS_LIMIT_5_000_000,
GAS_LIMIT_10_000_000,
GAS_LIMIT_800000,
GAS_LIMIT_8000000,
Expand All @@ -244,4 +252,6 @@ module.exports = {
WEEK,
WEI,
GWEI,
HTS_SYSTEM_CONTRACT_ADDRESS,
HAS_SYSTEM_CONTRACT_ADDRESS,
};
Loading

0 comments on commit 519d86e

Please sign in to comment.