From ba746e9f490e2e2f6d90568fdd4bd9f714a6787c Mon Sep 17 00:00:00 2001 From: WBT Date: Sat, 21 Oct 2023 21:51:13 -0400 Subject: [PATCH] Add bounds check --- packages/hardhat/contracts/SubscryptoToken.sol | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/hardhat/contracts/SubscryptoToken.sol b/packages/hardhat/contracts/SubscryptoToken.sol index 286be40..06c62c5 100644 --- a/packages/hardhat/contracts/SubscryptoToken.sol +++ b/packages/hardhat/contracts/SubscryptoToken.sol @@ -279,6 +279,7 @@ contract SubscryptoToken is ERC20, ERC20Burnable, Ownable, ERC20Permit { address customer, uint tierIndex ) private { + require(tierIndex < tiers[merchant].length, 'No such tier offered by this merchant.'); accountAtSubscriptionEnd(merchant, customer); subscriptions[merchant][customer] = Subscription({ tier: tierIndex,