0.1.1 • Published 4 months ago

@phylax-systems/phylax-std v0.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

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

forge install phylax-systems/phylax-std

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.

0.0.12

4 months ago

0.1.0

4 months ago

0.1.1

4 months ago

0.0.11

6 months ago

0.0.10

6 months ago

0.0.9

6 months ago

0.0.8

6 months ago

0.0.6

6 months ago

0.0.5

6 months ago

0.0.3

6 months ago

0.0.2

6 months ago

0.0.1

6 months ago

4.0.1

6 months ago