LCOV - code coverage report
Current view: top level - crypto/evm/entities/abi/uniswap_v2 - uniswap_v2_pair.dart (source / functions) Coverage Total Hit
Test: lcov.info Lines: 0.0 % 38 0
Test Date: 2025-04-01 01:23:07 Functions: - 0 0

            Line data    Source code
       1              : import 'package:walletkit_dart/walletkit_dart.dart';
       2              : 
       3            0 : final uniswap_v2_pair_abi = ContractABI.fromAbi('''
       4              :  [
       5              :     {
       6              :       "inputs": [],
       7              :       "stateMutability": "nonpayable",
       8              :       "type": "constructor"
       9              :     },
      10              :     {
      11              :       "anonymous": false,
      12              :       "inputs": [
      13              :         {
      14              :           "indexed": true,
      15              :           "internalType": "address",
      16              :           "name": "owner",
      17              :           "type": "address"
      18              :         },
      19              :         {
      20              :           "indexed": true,
      21              :           "internalType": "address",
      22              :           "name": "spender",
      23              :           "type": "address"
      24              :         },
      25              :         {
      26              :           "indexed": false,
      27              :           "internalType": "uint256",
      28              :           "name": "value",
      29              :           "type": "uint256"
      30              :         }
      31              :       ],
      32              :       "name": "Approval",
      33              :       "type": "event"
      34              :     },
      35              :     {
      36              :       "anonymous": false,
      37              :       "inputs": [
      38              :         {
      39              :           "indexed": true,
      40              :           "internalType": "address",
      41              :           "name": "sender",
      42              :           "type": "address"
      43              :         },
      44              :         {
      45              :           "indexed": false,
      46              :           "internalType": "uint256",
      47              :           "name": "amount0",
      48              :           "type": "uint256"
      49              :         },
      50              :         {
      51              :           "indexed": false,
      52              :           "internalType": "uint256",
      53              :           "name": "amount1",
      54              :           "type": "uint256"
      55              :         },
      56              :         {
      57              :           "indexed": true,
      58              :           "internalType": "address",
      59              :           "name": "to",
      60              :           "type": "address"
      61              :         }
      62              :       ],
      63              :       "name": "Burn",
      64              :       "type": "event"
      65              :     },
      66              :     {
      67              :       "anonymous": false,
      68              :       "inputs": [
      69              :         {
      70              :           "indexed": true,
      71              :           "internalType": "address",
      72              :           "name": "sender",
      73              :           "type": "address"
      74              :         },
      75              :         {
      76              :           "indexed": false,
      77              :           "internalType": "uint256",
      78              :           "name": "amount0",
      79              :           "type": "uint256"
      80              :         },
      81              :         {
      82              :           "indexed": false,
      83              :           "internalType": "uint256",
      84              :           "name": "amount1",
      85              :           "type": "uint256"
      86              :         }
      87              :       ],
      88              :       "name": "Mint",
      89              :       "type": "event"
      90              :     },
      91              :     {
      92              :       "anonymous": false,
      93              :       "inputs": [
      94              :         {
      95              :           "indexed": true,
      96              :           "internalType": "address",
      97              :           "name": "sender",
      98              :           "type": "address"
      99              :         },
     100              :         {
     101              :           "indexed": false,
     102              :           "internalType": "uint256",
     103              :           "name": "amount0In",
     104              :           "type": "uint256"
     105              :         },
     106              :         {
     107              :           "indexed": false,
     108              :           "internalType": "uint256",
     109              :           "name": "amount1In",
     110              :           "type": "uint256"
     111              :         },
     112              :         {
     113              :           "indexed": false,
     114              :           "internalType": "uint256",
     115              :           "name": "amount0Out",
     116              :           "type": "uint256"
     117              :         },
     118              :         {
     119              :           "indexed": false,
     120              :           "internalType": "uint256",
     121              :           "name": "amount1Out",
     122              :           "type": "uint256"
     123              :         },
     124              :         {
     125              :           "indexed": true,
     126              :           "internalType": "address",
     127              :           "name": "to",
     128              :           "type": "address"
     129              :         }
     130              :       ],
     131              :       "name": "Swap",
     132              :       "type": "event"
     133              :     },
     134              :     {
     135              :       "anonymous": false,
     136              :       "inputs": [
     137              :         {
     138              :           "indexed": false,
     139              :           "internalType": "uint112",
     140              :           "name": "reserve0",
     141              :           "type": "uint112"
     142              :         },
     143              :         {
     144              :           "indexed": false,
     145              :           "internalType": "uint112",
     146              :           "name": "reserve1",
     147              :           "type": "uint112"
     148              :         }
     149              :       ],
     150              :       "name": "Sync",
     151              :       "type": "event"
     152              :     },
     153              :     {
     154              :       "anonymous": false,
     155              :       "inputs": [
     156              :         {
     157              :           "indexed": true,
     158              :           "internalType": "address",
     159              :           "name": "from",
     160              :           "type": "address"
     161              :         },
     162              :         {
     163              :           "indexed": true,
     164              :           "internalType": "address",
     165              :           "name": "to",
     166              :           "type": "address"
     167              :         },
     168              :         {
     169              :           "indexed": false,
     170              :           "internalType": "uint256",
     171              :           "name": "value",
     172              :           "type": "uint256"
     173              :         }
     174              :       ],
     175              :       "name": "Transfer",
     176              :       "type": "event"
     177              :     },
     178              :     {
     179              :       "inputs": [],
     180              :       "name": "DOMAIN_SEPARATOR",
     181              :       "outputs": [
     182              :         {
     183              :           "internalType": "bytes32",
     184              :           "name": "",
     185              :           "type": "bytes32"
     186              :         }
     187              :       ],
     188              :       "stateMutability": "view",
     189              :       "type": "function"
     190              :     },
     191              :     {
     192              :       "inputs": [],
     193              :       "name": "MINIMUM_LIQUIDITY",
     194              :       "outputs": [
     195              :         {
     196              :           "internalType": "uint256",
     197              :           "name": "",
     198              :           "type": "uint256"
     199              :         }
     200              :       ],
     201              :       "stateMutability": "view",
     202              :       "type": "function"
     203              :     },
     204              :     {
     205              :       "inputs": [],
     206              :       "name": "PERMIT_TYPEHASH",
     207              :       "outputs": [
     208              :         {
     209              :           "internalType": "bytes32",
     210              :           "name": "",
     211              :           "type": "bytes32"
     212              :         }
     213              :       ],
     214              :       "stateMutability": "view",
     215              :       "type": "function"
     216              :     },
     217              :     {
     218              :       "inputs": [
     219              :         {
     220              :           "internalType": "address",
     221              :           "name": "",
     222              :           "type": "address"
     223              :         },
     224              :         {
     225              :           "internalType": "address",
     226              :           "name": "",
     227              :           "type": "address"
     228              :         }
     229              :       ],
     230              :       "name": "allowance",
     231              :       "outputs": [
     232              :         {
     233              :           "internalType": "uint256",
     234              :           "name": "",
     235              :           "type": "uint256"
     236              :         }
     237              :       ],
     238              :       "stateMutability": "view",
     239              :       "type": "function"
     240              :     },
     241              :     {
     242              :       "inputs": [
     243              :         {
     244              :           "internalType": "address",
     245              :           "name": "spender",
     246              :           "type": "address"
     247              :         },
     248              :         {
     249              :           "internalType": "uint256",
     250              :           "name": "value",
     251              :           "type": "uint256"
     252              :         }
     253              :       ],
     254              :       "name": "approve",
     255              :       "outputs": [
     256              :         {
     257              :           "internalType": "bool",
     258              :           "name": "",
     259              :           "type": "bool"
     260              :         }
     261              :       ],
     262              :       "stateMutability": "nonpayable",
     263              :       "type": "function"
     264              :     },
     265              :     {
     266              :       "inputs": [
     267              :         {
     268              :           "internalType": "address",
     269              :           "name": "",
     270              :           "type": "address"
     271              :         }
     272              :       ],
     273              :       "name": "balanceOf",
     274              :       "outputs": [
     275              :         {
     276              :           "internalType": "uint256",
     277              :           "name": "",
     278              :           "type": "uint256"
     279              :         }
     280              :       ],
     281              :       "stateMutability": "view",
     282              :       "type": "function"
     283              :     },
     284              :     {
     285              :       "inputs": [
     286              :         {
     287              :           "internalType": "address",
     288              :           "name": "to",
     289              :           "type": "address"
     290              :         }
     291              :       ],
     292              :       "name": "burn",
     293              :       "outputs": [
     294              :         {
     295              :           "internalType": "uint256",
     296              :           "name": "amount0",
     297              :           "type": "uint256"
     298              :         },
     299              :         {
     300              :           "internalType": "uint256",
     301              :           "name": "amount1",
     302              :           "type": "uint256"
     303              :         }
     304              :       ],
     305              :       "stateMutability": "nonpayable",
     306              :       "type": "function"
     307              :     },
     308              :     {
     309              :       "inputs": [],
     310              :       "name": "decimals",
     311              :       "outputs": [
     312              :         {
     313              :           "internalType": "uint8",
     314              :           "name": "",
     315              :           "type": "uint8"
     316              :         }
     317              :       ],
     318              :       "stateMutability": "view",
     319              :       "type": "function"
     320              :     },
     321              :     {
     322              :       "inputs": [],
     323              :       "name": "factory",
     324              :       "outputs": [
     325              :         {
     326              :           "internalType": "address",
     327              :           "name": "",
     328              :           "type": "address"
     329              :         }
     330              :       ],
     331              :       "stateMutability": "view",
     332              :       "type": "function"
     333              :     },
     334              :     {
     335              :       "inputs": [],
     336              :       "name": "getReserves",
     337              :       "outputs": [
     338              :         {
     339              :           "internalType": "uint112",
     340              :           "name": "_reserve0",
     341              :           "type": "uint112"
     342              :         },
     343              :         {
     344              :           "internalType": "uint112",
     345              :           "name": "_reserve1",
     346              :           "type": "uint112"
     347              :         },
     348              :         {
     349              :           "internalType": "uint32",
     350              :           "name": "_blockTimestampLast",
     351              :           "type": "uint32"
     352              :         }
     353              :       ],
     354              :       "stateMutability": "view",
     355              :       "type": "function"
     356              :     },
     357              :     {
     358              :       "inputs": [
     359              :         {
     360              :           "internalType": "address",
     361              :           "name": "_token0",
     362              :           "type": "address"
     363              :         },
     364              :         {
     365              :           "internalType": "address",
     366              :           "name": "_token1",
     367              :           "type": "address"
     368              :         }
     369              :       ],
     370              :       "name": "initialize",
     371              :       "outputs": [],
     372              :       "stateMutability": "nonpayable",
     373              :       "type": "function"
     374              :     },
     375              :     {
     376              :       "inputs": [],
     377              :       "name": "kLast",
     378              :       "outputs": [
     379              :         {
     380              :           "internalType": "uint256",
     381              :           "name": "",
     382              :           "type": "uint256"
     383              :         }
     384              :       ],
     385              :       "stateMutability": "view",
     386              :       "type": "function"
     387              :     },
     388              :     {
     389              :       "inputs": [
     390              :         {
     391              :           "internalType": "address",
     392              :           "name": "to",
     393              :           "type": "address"
     394              :         }
     395              :       ],
     396              :       "name": "mint",
     397              :       "outputs": [
     398              :         {
     399              :           "internalType": "uint256",
     400              :           "name": "liquidity",
     401              :           "type": "uint256"
     402              :         }
     403              :       ],
     404              :       "stateMutability": "nonpayable",
     405              :       "type": "function"
     406              :     },
     407              :     {
     408              :       "inputs": [],
     409              :       "name": "name",
     410              :       "outputs": [
     411              :         {
     412              :           "internalType": "string",
     413              :           "name": "",
     414              :           "type": "string"
     415              :         }
     416              :       ],
     417              :       "stateMutability": "view",
     418              :       "type": "function"
     419              :     },
     420              :     {
     421              :       "inputs": [
     422              :         {
     423              :           "internalType": "address",
     424              :           "name": "",
     425              :           "type": "address"
     426              :         }
     427              :       ],
     428              :       "name": "nonces",
     429              :       "outputs": [
     430              :         {
     431              :           "internalType": "uint256",
     432              :           "name": "",
     433              :           "type": "uint256"
     434              :         }
     435              :       ],
     436              :       "stateMutability": "view",
     437              :       "type": "function"
     438              :     },
     439              :     {
     440              :       "inputs": [
     441              :         {
     442              :           "internalType": "address",
     443              :           "name": "owner",
     444              :           "type": "address"
     445              :         },
     446              :         {
     447              :           "internalType": "address",
     448              :           "name": "spender",
     449              :           "type": "address"
     450              :         },
     451              :         {
     452              :           "internalType": "uint256",
     453              :           "name": "value",
     454              :           "type": "uint256"
     455              :         },
     456              :         {
     457              :           "internalType": "uint256",
     458              :           "name": "deadline",
     459              :           "type": "uint256"
     460              :         },
     461              :         {
     462              :           "internalType": "uint8",
     463              :           "name": "v",
     464              :           "type": "uint8"
     465              :         },
     466              :         {
     467              :           "internalType": "bytes32",
     468              :           "name": "r",
     469              :           "type": "bytes32"
     470              :         },
     471              :         {
     472              :           "internalType": "bytes32",
     473              :           "name": "s",
     474              :           "type": "bytes32"
     475              :         }
     476              :       ],
     477              :       "name": "permit",
     478              :       "outputs": [],
     479              :       "stateMutability": "nonpayable",
     480              :       "type": "function"
     481              :     },
     482              :     {
     483              :       "inputs": [],
     484              :       "name": "price0CumulativeLast",
     485              :       "outputs": [
     486              :         {
     487              :           "internalType": "uint256",
     488              :           "name": "",
     489              :           "type": "uint256"
     490              :         }
     491              :       ],
     492              :       "stateMutability": "view",
     493              :       "type": "function"
     494              :     },
     495              :     {
     496              :       "inputs": [],
     497              :       "name": "price1CumulativeLast",
     498              :       "outputs": [
     499              :         {
     500              :           "internalType": "uint256",
     501              :           "name": "",
     502              :           "type": "uint256"
     503              :         }
     504              :       ],
     505              :       "stateMutability": "view",
     506              :       "type": "function"
     507              :     },
     508              :     {
     509              :       "inputs": [
     510              :         {
     511              :           "internalType": "address",
     512              :           "name": "to",
     513              :           "type": "address"
     514              :         }
     515              :       ],
     516              :       "name": "skim",
     517              :       "outputs": [],
     518              :       "stateMutability": "nonpayable",
     519              :       "type": "function"
     520              :     },
     521              :     {
     522              :       "inputs": [
     523              :         {
     524              :           "internalType": "uint256",
     525              :           "name": "amount0Out",
     526              :           "type": "uint256"
     527              :         },
     528              :         {
     529              :           "internalType": "uint256",
     530              :           "name": "amount1Out",
     531              :           "type": "uint256"
     532              :         },
     533              :         {
     534              :           "internalType": "address",
     535              :           "name": "to",
     536              :           "type": "address"
     537              :         },
     538              :         {
     539              :           "internalType": "bytes",
     540              :           "name": "data",
     541              :           "type": "bytes"
     542              :         }
     543              :       ],
     544              :       "name": "swap",
     545              :       "outputs": [],
     546              :       "stateMutability": "nonpayable",
     547              :       "type": "function"
     548              :     },
     549              :     {
     550              :       "inputs": [],
     551              :       "name": "symbol",
     552              :       "outputs": [
     553              :         {
     554              :           "internalType": "string",
     555              :           "name": "",
     556              :           "type": "string"
     557              :         }
     558              :       ],
     559              :       "stateMutability": "view",
     560              :       "type": "function"
     561              :     },
     562              :     {
     563              :       "inputs": [],
     564              :       "name": "sync",
     565              :       "outputs": [],
     566              :       "stateMutability": "nonpayable",
     567              :       "type": "function"
     568              :     },
     569              :     {
     570              :       "inputs": [],
     571              :       "name": "token0",
     572              :       "outputs": [
     573              :         {
     574              :           "internalType": "address",
     575              :           "name": "",
     576              :           "type": "address"
     577              :         }
     578              :       ],
     579              :       "stateMutability": "view",
     580              :       "type": "function"
     581              :     },
     582              :     {
     583              :       "inputs": [],
     584              :       "name": "token1",
     585              :       "outputs": [
     586              :         {
     587              :           "internalType": "address",
     588              :           "name": "",
     589              :           "type": "address"
     590              :         }
     591              :       ],
     592              :       "stateMutability": "view",
     593              :       "type": "function"
     594              :     },
     595              :     {
     596              :       "inputs": [],
     597              :       "name": "totalSupply",
     598              :       "outputs": [
     599              :         {
     600              :           "internalType": "uint256",
     601              :           "name": "",
     602              :           "type": "uint256"
     603              :         }
     604              :       ],
     605              :       "stateMutability": "view",
     606              :       "type": "function"
     607              :     },
     608              :     {
     609              :       "inputs": [
     610              :         {
     611              :           "internalType": "address",
     612              :           "name": "to",
     613              :           "type": "address"
     614              :         },
     615              :         {
     616              :           "internalType": "uint256",
     617              :           "name": "value",
     618              :           "type": "uint256"
     619              :         }
     620              :       ],
     621              :       "name": "transfer",
     622              :       "outputs": [
     623              :         {
     624              :           "internalType": "bool",
     625              :           "name": "",
     626              :           "type": "bool"
     627              :         }
     628              :       ],
     629              :       "stateMutability": "nonpayable",
     630              :       "type": "function"
     631              :     },
     632              :     {
     633              :       "inputs": [
     634              :         {
     635              :           "internalType": "address",
     636              :           "name": "from",
     637              :           "type": "address"
     638              :         },
     639              :         {
     640              :           "internalType": "address",
     641              :           "name": "to",
     642              :           "type": "address"
     643              :         },
     644              :         {
     645              :           "internalType": "uint256",
     646              :           "name": "value",
     647              :           "type": "uint256"
     648              :         }
     649              :       ],
     650              :       "name": "transferFrom",
     651              :       "outputs": [
     652              :         {
     653              :           "internalType": "bool",
     654              :           "name": "",
     655              :           "type": "bool"
     656              :         }
     657              :       ],
     658              :       "stateMutability": "nonpayable",
     659              :       "type": "function"
     660              :     }
     661              :   ]
     662              : ''');
     663              : 
     664              : class UniswapV2Pair extends InternalContract {
     665            0 :   UniswapV2Pair({
     666              :     required super.contractAddress,
     667              :     required super.rpc,
     668            0 :   }) : super(abi: uniswap_v2_pair_abi);
     669              : 
     670            0 :   Future<(BigInt, BigInt)> getReserves() async {
     671            0 :     final function = abi.getFunction('getReserves')!;
     672              : 
     673            0 :     final response = await readSafe(
     674            0 :       function: function.addValues(values: []),
     675              :     );
     676              : 
     677              :     return (
     678            0 :       response.outputs[0].value as BigInt,
     679            0 :       response.outputs[1].value as BigInt,
     680              :     );
     681              :   }
     682              : 
     683            0 :   Future<String> token0() async {
     684            0 :     final function = abi.getFunction('token0')!;
     685              : 
     686            0 :     final response = await readSafe(
     687            0 :       function: function.addValues(values: []),
     688              :     );
     689              : 
     690            0 :     return response.outputs[0].value as String;
     691              :   }
     692              : 
     693            0 :   Future<String> token1() async {
     694            0 :     final function = abi.getFunction('token1')!;
     695              : 
     696            0 :     final response = await readSafe(
     697            0 :       function: function.addValues(values: []),
     698              :     );
     699              : 
     700            0 :     return response.outputs[0].value as String;
     701              :   }
     702              : 
     703            0 :   Future<BigInt> balanceOf(String address) async {
     704            0 :     final function = abi.getFunction('balanceOf')!;
     705              : 
     706            0 :     final response = await readSafe(
     707            0 :       function: function.addValues(values: [address]),
     708              :     );
     709              : 
     710            0 :     return response.outputs[0].value as BigInt;
     711              :   }
     712              : 
     713            0 :   Future<BigInt> totalSupply() async {
     714            0 :     final function = abi.getFunction('totalSupply')!;
     715              : 
     716            0 :     final response = await readSafe(
     717            0 :       function: function.addValues(values: []),
     718              :     );
     719              : 
     720            0 :     return response.outputs[0].value as BigInt;
     721              :   }
     722              : 
     723            0 :   Future<RawEvmTransaction> approveTx({
     724              :     required String sender,
     725              :     required String spender,
     726              :     required BigInt value,
     727              :     EvmFeeInformation? feeInfo,
     728              :   }) async {
     729            0 :     final function = abi.getFunction('approve')!;
     730            0 :     return await buildTransactionForFunction(
     731            0 :       function: function.addValues(values: [spender, value]),
     732              :       sender: sender,
     733              :       feeInfo: feeInfo,
     734              :     );
     735              :   }
     736              : 
     737            0 :   Future<BigInt> allowance({
     738              :     required String owner,
     739              :     required String spender,
     740              :   }) async {
     741            0 :     final function = abi.getFunction('allowance')!;
     742            0 :     final response = await readSafe(
     743            0 :       function: function.addValues(values: [owner, spender]),
     744              :     );
     745            0 :     return response.outputs.first.castValue<BigInt>();
     746              :   }
     747              : }
        

Generated by: LCOV version 2.0-1