@@ -68,8 +68,8 @@ contract NativeTokenStreamingEnforcer is CaveatEnforcer {
6868 view
6969 returns (uint256 availableAmount_ )
7070 {
71- StreamingAllowance storage allowance = streamingAllowances[_delegationManager][_delegationHash];
72- availableAmount_ = _getAvailableAmount (allowance );
71+ StreamingAllowance storage allowance_ = streamingAllowances[_delegationManager][_delegationHash];
72+ availableAmount_ = _getAvailableAmount (allowance_ );
7373 }
7474
7575 /**
@@ -145,27 +145,25 @@ contract NativeTokenStreamingEnforcer is CaveatEnforcer {
145145 )
146146 private
147147 {
148- (, uint256 value ,) = _executionCallData.decodeSingle ();
148+ (, uint256 value_ ,) = _executionCallData.decodeSingle ();
149149
150150 (uint256 initialAmount_ , uint256 maxAmount_ , uint256 amountPerSecond_ , uint256 startTime_ ) = getTermsInfo (_terms);
151151
152152 require (maxAmount_ >= initialAmount_, "NativeTokenStreamingEnforcer:invalid-max-amount " );
153153 require (startTime_ > 0 , "NativeTokenStreamingEnforcer:invalid-zero-start-time " );
154154
155- StreamingAllowance storage allowance = streamingAllowances[msg .sender ][_delegationHash];
156- if (allowance .spent == 0 ) {
155+ StreamingAllowance storage allowance_ = streamingAllowances[msg .sender ][_delegationHash];
156+ if (allowance_ .spent == 0 ) {
157157 // First use of this delegation
158- allowance .initialAmount = initialAmount_;
159- allowance .maxAmount = maxAmount_;
160- allowance .amountPerSecond = amountPerSecond_;
161- allowance .startTime = startTime_;
158+ allowance_ .initialAmount = initialAmount_;
159+ allowance_ .maxAmount = maxAmount_;
160+ allowance_ .amountPerSecond = amountPerSecond_;
161+ allowance_ .startTime = startTime_;
162162 }
163163
164- uint256 transferAmount_ = value ;
164+ require (value_ <= _getAvailableAmount (allowance_), " NativeTokenStreamingEnforcer:allowance-exceeded " ) ;
165165
166- require (transferAmount_ <= _getAvailableAmount (allowance), "NativeTokenStreamingEnforcer:allowance-exceeded " );
167-
168- allowance.spent += transferAmount_;
166+ allowance_.spent += value_;
169167
170168 emit IncreasedSpentMap (
171169 msg .sender ,
@@ -175,7 +173,7 @@ contract NativeTokenStreamingEnforcer is CaveatEnforcer {
175173 maxAmount_,
176174 amountPerSecond_,
177175 startTime_,
178- allowance .spent,
176+ allowance_ .spent,
179177 block .timestamp
180178 );
181179 }
0 commit comments