Skip to content

Wrapped PAC (WPAC) token contract for bridging PAC coins between EVM blockchains and Pactus blockchain.

License

Notifications You must be signed in to change notification settings

wrapto/wpac-erc-20

Repository files navigation

Wrapped PAC (WPAC) Token

Welcome to the repository for the Wrapped PAC (WPAC) token. WPAC is a wrapped token (ERC-20) compatible with all EVM blockchains, providing interoperability for PAC tokens across different networks.

Project Overview

WPAC tokens are wrapped tokens provided by the Wrapto platform. The token contract is implemented in Solidity and follows the OpenZeppelin Contracts upgradeable pattern. It allows users to bridge PAC tokens from one blockchain to another by locking the tokens in the contract and minting WPAC tokens on the destination chain.

Getting Started

To get started with the project, follow these steps:

git clone https://github.com/wrapto/wpac-erc-20.git
cd wpac-erc-20
npm install

Deploying the Smart Contract

The project uses a unified Hardhat configuration that includes both testnet and mainnet networks. You control which network to use by specifying the network name.

You need to manually adjust parameters in hardhat.config.ts such as defining RPC URLs, account private keys, etc.

Deploying

There are two deployment entry points, depending on whether you want a standalone contract or an upgradeable proxy setup:

  • Deploy only the implementation (no proxy):

    npx hardhat run ./scripts/deploy_contract.ts --network <NETWORK-NAME>
  • Deploy a proxy + implementation pair:

    npx hardhat run ./scripts/deploy_proxy.ts --network <NETWORK-NAME>

Upgrading

To upgrade on a specific network:

npx hardhat run ./scripts/upgrade.ts --network <NETWORK-NAME>

Available Networks

Local Network:

  • hardhat - Local Hardhat Network (default network; no network flag needed)

Testnet Networks:

  • polygon_amoy - Polygon Amoy Testnet
  • bsc_testnet - BSC Testnet
  • base_sepolia - Base Sepolia Testnet
  • ethereum_sepolia - Ethereum Sepolia Testnet

Mainnet Networks:

  • polygon - Polygon Mainnet
  • bsc - BSC Mainnet
  • base - Base Mainnet
  • ethereum - Ethereum Mainnet

Using Trezor Hardware Wallet

To deploy or upgrade using a Trezor hardware wallet, set the TREZOR_BIP44_PATH environment variable and then:

npx hardhat run ./scripts/upgrade.ts --network <NETWORK-NAME>

Available Scripts

In the project directory, you can run the following scripts:

  • npm run node: Starts a local Hardhat node for testing.
  • npm run compile: Compiles the Solidity contracts.
  • npm run clean: Cleans up artifacts, cache, coverage, and typechain files.
  • npm run lint:sol: Lints the Solidity contracts using Solhint.
  • npm run test: Runs the Hardhat test suite.
  • npm run typechain: Generates TypeScript bindings for the Solidity contracts.

Contract Overview

The main contract file is wpac.sol which implements the ERC-20 interface. It also integrates functionality for bridging PAC tokens from one blockchain to another. The contract is upgradeable and follows the Ownable and Pausable patterns for security and control.

Project Structure

The main project files and directories are structured as follows:

  • contracts/: Contains Solidity contracts.
  • test/: Contains test scripts for the contracts.
  • scripts/: Contains deployment and upgrade scripts.
  • artifacts/: Contains contract artifacts generated by Hardhat.
  • package.json: Configuration file for Node.js dependencies and scripts.
  • hardhat.config.ts: Hardhat configuration (includes both testnet and mainnet networks).

License

Wrapto is released under MIT License.

About

Wrapped PAC (WPAC) token contract for bridging PAC coins between EVM blockchains and Pactus blockchain.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •