Socket
Book a DemoInstallSign in
Socket

@phylax-systems/phylax-std

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@phylax-systems/phylax-std

The standard libary of Phylax, the easiest way to monitor smart contracts.

latest
npmnpm
Version
0.1.1
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

Phylax Standard Library

CI status

Phylax Standard Library is a collection of helpful contracts and libraries for use with Phylax. It provides a set of interfaces and contracts to interact with Phylax and Foundry.

Install

Foundry

forge install phylax-systems/phylax-std

Yarn

yarn add @phylax-systems/phylax-std

and add the following remappings to your project by creating the remappings.txt.

forge-std/=node_modules/forge-std/src/
ds-test/=node_modules/ds-test/src/

Forking

Forking uses Foundry in the background, so you can follow the same best practices:

  • Set the RPC url inside the contract
  • Set the RPC url in an env variable and then use the relevant Foundry cheatcodes to get it
  • Set the RPC url inside foundry.toml and use an alias in the contracts

Read more in the Foundry Fork Testing Docs.

Contracts

Phylax

This is the main interface for interacting with Phylax. It enables the Phylax-only Foundry cheatcodes, such as ph.export(string,string).

Action

This is the base contract for all Phylax alert contracts. It provides a constant reference to Phylax and RE-IMPORTS forge-std/Script.sol.

Action Interface

Read the docs at https://phylax-std.phylax.watch

Action Usage

import { Action } from "phylax-std/Action.sol";

contract PauseProtocol is Action {
    function run() public {
        // pause protocol
        uint256 collateral_left = protocol.collateral_left();
        ph.export("collateral_left", collateral_left);
    }
}

Alert

This is the base contract for all Phylax alert contracts. It provides a constant reference to Phylax and RE-IMPORTS forge-std/Test.sol.

Alert Interface

Read the docs at https://phylax-std.phylax.watch

Alert Usage

import { Alert } from "phylax-std/Alert.sol";

contract CollateralAlert is Alert {

    uint256 polygon;
    uint256 ethereum;

    uint256 BASELINE_BLOCK = 5000;

    function setUp() public {
        polygon = enableChain(<RPC_URL>);
        ethereum = enableChain(<RPC_URL>, BASELINE_BLOCK);
    }

    function testCollateralPolygon() chain(polygon) public {
        // ...
    }

    function testCollateralPolygonBaseline() chain(ethereum) public {
        // ...
    }
}

License

Phylax Standard Library is offered under either MIT or Apache 2.0.

Keywords

smart-contracts

FAQs

Package last updated on 28 Dec 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