open-index/open-npm huggingface dataset:
npm package: @mapprotocol/common-contracts
Description: Common contracts for MAP Protocol
Author: MAP Protocol
Latest version: 0.1.1

# @mapprotocol/common-contracts

Common smart contracts library for MAP Protocol.

## Installation

```bash
npm install @mapprotocol/common-contracts
```

or

```bash
yarn add @mapprotocol/common-contracts
```

## Usage

### Solidity Contracts

Import contracts in your Solidity files:

```solidity
import "@mapprotocol/common-contracts/contracts/base/BaseImplemention.sol";
import "@mapprotocol/common-contracts/contracts/AuthorityManager.sol";
```

### TypeScript/JavaScript

Use TypeChain generated types for type-safe contract interactions:

```typescript
import { BaseImplement__factory } from "@mapprotocol/common-contracts";
import { ethers } from "ethers";

// Deploy or connect to contract
const signer = await ethers.getSigner();
const baseContract = await BaseImplement__factory.deploy(signer);

// Or connect to existing contract
const contractAddress = "0x...";
const contract = BaseImplement__factory.connect(contractAddress, signer);
```

## Contracts Overview

### Base Contracts
- `BaseImplemention.sol` - Base implementation with common functionality including pausable, reentrancy guard, and UUPS upgradeable patterns

### Authority Management
- `AuthorityManager.sol` - Authority and access control management

## Features

- **Upgradeable**: Contracts use UUPS (Universal Upgradeable Proxy Standard) pattern
- **Pausable**: Emergency pause functionality for critical operations
- **Reentrancy Protection**: Built-in reentrancy guards for secure operations
- **Access Control**: Flexible authority management system
- **TypeScript Support**: Full TypeChain generated types for type-safe development

## Development

This library uses a dual toolchain setup:

### Foundry
```bash
forge build          # Build contracts
forge test           # Run tests
forge fmt            # Format code
```

### Hardhat
```bash
npm run build:hardhat    # Build with Hardhat
npm run test:hardhat     # Run Hardhat tests
npm run compile          # Compile and generate types
```

### Other Commands
```bash
npm run clean            # Clean all artifacts
npm run typecheck        # Check TypeScript types
npm run gas-report       # Generate gas usage report
npm run coverage         # Generate test coverage
```

## Requirements

- Node.js >= 18.0.0
- Solidity 0.8.20

## Dependencies

- OpenZeppelin Contracts v5.0.0
- OpenZeppelin Contracts Upgradeable v5.0.0

## License

MIT

## Repository

[GitHub](https://github.com/mapprotocol/mapo-contracts-v2/tree/main/common)

## Issues

Please report issues at [GitHub Issues](https://github.com/mapprotocol/mapo-contracts-v2/issues)
npm package: @mapprotocol/protocol
Description: MAP Protocol management and utils contracts
Author: MAP Protocol
Latest version: 0.8.5

# MAP Protocol management contracts

## Introduction


### Deploy Factory

The factory contract helps to deploy to deterministic addresses without an init code factor.
Every developer can use contract `0x6258e4d2950757A749a4d4683A7342261ce12471` to deploy deterministic addresses contract.

Read [this](https://github.com/mapprotocol/map-contracts/blob/main/protocol/contracts/create3/README.md) to get more information.

### MPT verifier
The contract deployed on the MAP Relay Chain is responsible for MPT proof verify.
Deployed address: 
 - MAPO mainnet: `0xC68a029cFfCF3eAa42Dad4bf6c0200Ad5fA4b161`
 - Makalu testnet: `0xC68a029cFfCF3eAa42Dad4bf6c0200Ad5fA4b161`

```solidity
interface IMPTVerify {
    function verifyTrieProof(
        bytes32 _root,
        bytes32 _value,
        bytes memory _key,
        bytes[] memory _proof
    ) external pure returns (bool);
}
```

### Light client manager
The contract deployed on the MAP Relay Chain is responsible for managing light clients, it helps:
- Register light client
- Verify cross chain proof
- Get light client verification range

Deployed address:
- MAPO mainnet: `0x624E6F327c4F91F1Fa6285711245c215de264d49`
- Makalu testnet: `0xDD3A69f8f59d892476B0be0260932b4f8d8268Ff`


## Compile

Build using the following commands:

```shell
git clone https://github.com/mapprotocol/map-contracts.git
cd protocol
npm install
npx hardhat compile
```


## Test

```shell
npx hardhat test
```

## Deploy

```shell
npx hardhat deploy --tags MaintainerManager --network <network>

npx hardhat deploy --tags LightClientManager --network <network>
```

## Upgrade

```shell
npx hardhat deploy --tags MaintainerManagerUp --network <network>

npx hardhat deploy --tags LightClientManagerUp --network <network>
```


## Useage

### Register a light client

cmd
```shell
npx hardhat clientRegister --chain <chain id for light client> --contract <contract for light client>  --network <network>
```

example
```shell
  npx hardhat clientRegister --chain 1 --contract "0x366db0D543b709434Cb91113270521e50fC2fe49" --network Map
```

### Add or remove a maintainer

cmd
```shell
 npx hardhat MaintainerWhileListSet --add <add:true remove:false> --address <Maintainer address> --network <network>
```
example

```shell
  npx hardhat MaintainerWhileListSet --add true --address "0x2f6950D5adE9025266677946c1E0233526387219" --network Map
```
npm package: @mapquest/directions
Description: JS interface to MapQuest Directions API. Returns GeoJSON with traffic segments.
Author: Florin Alexandrescu & Marc Bernardini
Latest version: 0.3.3

# MQ-Directions

This is a JavaScript interface to the [MapQuest Directions API](https://developer.mapquest.com/documentation/directions-api/).
The `route()` method returns a Promise fulfilled with a GeoJSON FeatureCollection of available routes divided
in traffic segments and maneuver points. It's up to you to style the results for map display with a custom style function based
on the GeoJSON feature properties.
The `getShape()` method returns a detailed route shape suitable for all zoom levels.

**Example**

```javascript
const Directions = require('@mapquest/directions');
const directions = new Directions({key:'your-key'});

directions.route({
  locations: [
    'chicago, il',
    'lansing, mi'
  ],
  maxRoutes: 3,
  timeOverage: 99
})
.then(function(results){
    console.log('results is a GeoJSON of the available routes and maneuver points', results);

    const firstRouteId = results.properties.routeSessionIds[0];  //access routeSessionIds here
    return directions.getShape(firstRouteId)   //get the detailed route shape
})
.then(draw)
```
npm package: @mapquest/geocoding
Description: MapQuest Geocoding
Author: Florin Alexandrescu
Latest version: 0.0.4

# MQ Geocoding

A JavaScript interface to the [MapQuest Geocoding API](https://developer.mapquest.com/documentation/geocoding-api/).
You must obtain a key before using this service. This module can be used in the browser and server side.

Examples:

```javascript
//setup the module
const Geocoding = require('@mapquest/geocoding');
const client = new Geocoding({key: 'xxxxxxx'})

//forward geocode
client.forward('1555 Blake St. Denver, CO 80204')
  .then(result => {
    console.log(result); // returns a GeoJson point of the first match
   })

//reverse geocode
client.reverse(39.75, -104.99)  //lat, lng
  .then(result => {
    console.log(result.addressString); //single line address, ie: "1555 Blake St., Denver, CO 80204"
    console.log(result.location); //geocoding service response
   })
```