@@ -208,10 +208,9 @@ describe('TokenPaymaster', function () {
208208 const refundTokens = decodedLogs [ 2 ] . args . value
209209 const actualTokenChargeEvents = preChargeTokens . sub ( refundTokens )
210210 const actualTokenCharge = decodedLogs [ 3 ] . args . actualTokenCharge
211- const actualTokenPrice = decodedLogs [ 3 ] . args . actualTokenPrice
211+ const actualTokenPriceWithMarkup = decodedLogs [ 3 ] . args . actualTokenPriceWithMarkup
212212 const actualGasCostPaymaster = decodedLogs [ 3 ] . args . actualGasCost
213213 const actualGasCostEntryPoint = decodedLogs [ 4 ] . args . actualGasCost
214- const expectedTokenPrice = initialPriceToken / initialPriceEther // ether is 5x the token => ether-per-token is 0.2
215214 const addedPostOpCost = BigNumber . from ( op . maxFeePerGas ) . mul ( 40000 )
216215
217216 // note: as price is in ether-per-token, and we want more tokens, increasing it means dividing it by markup
@@ -224,7 +223,7 @@ describe('TokenPaymaster', function () {
224223 assert . equal ( decodedLogs [ 4 ] . args . success , true )
225224 assert . equal ( actualTokenChargeEvents . toString ( ) , actualTokenCharge . toString ( ) )
226225 assert . equal ( actualTokenChargeEvents . toString ( ) , expectedTokenCharge . toString ( ) )
227- assert . equal ( actualTokenPrice / ( priceDenominator as any ) , expectedTokenPrice )
226+ assert . equal ( actualTokenPriceWithMarkup . toString ( ) , expectedTokenPriceWithMarkup . toString ( ) )
228227 assert . closeTo ( postOpGasCost . div ( tx . effectiveGasPrice ) . toNumber ( ) , 50000 , 20000 )
229228 await ethers . provider . send ( 'evm_revert' , [ snapshot ] )
230229 } )
@@ -256,10 +255,11 @@ describe('TokenPaymaster', function () {
256255
257256 const oldExpectedPrice = priceDenominator . mul ( initialPriceToken ) . div ( initialPriceEther )
258257 const newExpectedPrice = oldExpectedPrice . div ( 2 ) // ether DOUBLED in price relative to token
258+ const oldExpectedPriceWithMarkup = oldExpectedPrice . mul ( 10 ) . div ( 15 )
259+ const newExpectedPriceWithMarkup = oldExpectedPriceWithMarkup . div ( 2 )
259260
260- const actualTokenPrice = decodedLogs [ 4 ] . args . actualTokenPrice
261- assert . equal ( actualTokenPrice . toString ( ) , newExpectedPrice . toString ( ) )
262-
261+ const actualTokenPriceWithMarkup = decodedLogs [ 4 ] . args . actualTokenPriceWithMarkup
262+ assert . equal ( actualTokenPriceWithMarkup . toString ( ) , newExpectedPriceWithMarkup . toString ( ) )
263263 await expect ( tx ) . to
264264 . emit ( paymaster , 'TokenPriceUpdated' )
265265 . withArgs ( newExpectedPrice , oldExpectedPrice , block . timestamp )
0 commit comments