Socket
Book a DemoInstallSign in
Socket

@swapica/core-contracts

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@swapica/core-contracts

Cross-chain atomic swaps

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
2
Created
Source

Swapica contracts

This repository contains Swapica core contracts. All contracts are managed and indexed by backend services using modified EIP-191 standard signatures.

  • ./contracts/core/Swapica.sol Swapica contract, which allows creating, executing, and canceling orders and matches.
  • ./contracts/relayer/Relayer.sol Relayer contract that facilitates the orders matching by executing executeOrder and executeMatch methods on the Swapica contract. The Relayer is optional, and it charges set fees from users for this service.

Overview

Installation

$ npm install @swapica/core-contracts

Run Tests

$ npm run test

Deployment

To deploy contracts, first configure ./.env based on the ./.env.example file. After that, you can run the migration script with the desired network (see ./package.json scripts):

$ npm run deploy-sepolia

Usage

Once the npm package is installed, one can use the swapica core contracts just like that:

pragma solidity ^0.8.19;

import "@swapica/core-contracts/interfaces/core/ISwapica.sol";

contract ExampleContract {
    function getLatestOrder(address swapica) external view returns (ISwapica.Order memory order) {
        uint256 ordersLength = ISwapica(swapica).getUserOrdersLength(msg.sender);

        require(ordersLength > 0, "ExampleContract: no orders");

        return ISwapica(swapica).getUserOrders(msg.sender, ordersLength - 1, 1)[0];
    }
}

FAQs

Package last updated on 18 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts