Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

The contracts describing the Tryvium Pay Universal Token Swapper

Notifications You must be signed in to change notification settings

tryvium-travels/uts-paper-example

Repository files navigation

GitHub Twitter Follow

Tryvium Travels - Universal Token Swapper (UTS)

WARNING: This repository is in early-alpha version, highly unstable and is not definitely ready for production use.

The Tryvium Universal Token Swapper, a new way to transform swaps into payments.

Usage

Initialize the ETH_INFURA_RPC_URL variable with a valid infura RPC node URL to enable tests.

export ETH_INFURA_RPC_URL="<your-personal-infura-rpc-url>"

Copy the contracts in your project. After that you can refer to them in your contract like this:

pragma solidity ^0.8.13;

import "ITokenSwapper.sol";

contract MultiPayerExample {
  swapper ITokenSwapper private immutable;

  // and so on...
}

Or extend the functionality of the current swappers like this:

pragma solidity ^0.8.13;

import "ITokenSwapper.sol";

contract ExtendedTokenSwapper is ITokenSwapper {
  // implement the ITokenSwapper virtual methods
}

that's it.

Need some test mocks for your dex routers ?

You can use ours !!! Check the contract we have in the contracts/test folder.


APPENDIX: How to build locally

First of all you need to install the dependencies

yarn install

Then you can add your solidity smart contracts to the contracts directory and the contract tests to the test directory.

Finally, you can build your contracts using

yarn build

and you can test them using hardhat.

yarn hardhat test

You can also run mythril security tests using the command:

yarn run mythril-security-checks
# or simply
yarn mythril-security-checks

This project is powered by waffle, Typescript and hardhat.

Please, see the details of the scripts in package.json file.

Running tests in VSCode UI

The content comes from this page.

You can run your tests from Visual Studio Code by using one of its Mocha integration extensions. We recommend using Mocha Test Explorer.

Making TypeScript tests work

Running tests written in TypeScript from Visual Studio Code requires you to set the vscode option "mochaExplorer.files" to "test/**/*.{j,t}s".

Or simply use the vscode/settings.json file from this repository.