Skip to content

Commit 9e7b6d9

Browse files
authored
feat(per): Per solidity sdk (#1325)
* feat(per): add solidity sdk * refactor(evm): refactor abi generator script * feat(evm): add abi_generator package
1 parent e986b69 commit 9e7b6d9

File tree

16 files changed

+347
-261
lines changed

16 files changed

+347
-261
lines changed

express_relay/sdk/js/package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
"name": "@pythnetwork/express-relay-evm-js",
33
"version": "0.1.1",
44
"description": "Utilities for interacting with the express relay protocol",
5-
"homepage": "https://pyth.network",
6-
"author": {
7-
"name": "Pyth Data Association"
8-
},
5+
"homepage": "https://github.com/pyth-network/pyth-crosschain/tree/main/express_relay/sdk/js",
6+
"author": "Douro Labs",
97
"main": "lib/index.js",
108
"types": "lib/index.d.ts",
119
"files": [
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// SPDX-License-Identifier: UNLICENSED
2+
// Copyright (C) 2024 Lavra Holdings Limited - All Rights Reserved
3+
pragma solidity ^0.8.0;
4+
5+
interface IPERFeeReceiver {
6+
// Receive the proceeds of an auction.
7+
// @param permissionKey The permission key where the auction was conducted on.
8+
function receiveAuctionProceedings(
9+
bytes calldata permissionKey
10+
) external payable;
11+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// SPDX-License-Identifier: UNLICENSED
2+
// Copyright (C) 2024 Lavra Holdings Limited - All Rights Reserved
3+
pragma solidity ^0.8.0;
4+
5+
interface IPERMulticall {
6+
// Check if the combination of protocol and permissionKey is allowed within this transaction.
7+
// This will return true if and only if it's being called while executing the auction winner call.
8+
// @param protocol The address of the protocol that is gating an action behind this permission
9+
// @param permissionKey The permission key that is being checked
10+
// @return permissioned True if the permission is allowed, false otherwise
11+
function isPermissioned(
12+
address protocol,
13+
bytes calldata permissionKey
14+
) external view returns (bool permissioned);
15+
}

express_relay/sdk/solidity/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Pyth Express Relay Solidity SDK
2+
3+
## Install
4+
5+
### Truffle/Hardhat
6+
7+
If you are using Truffle or Hardhat, simply install the NPM package:
8+
9+
```bash
10+
npm install @pythnetwork/per-sdk-solidity
11+
```
12+
13+
### Foundry
14+
15+
If you are using Foundry, you will need to create an NPM project if you don't already have one.
16+
From the root directory of your project, run:
17+
18+
```bash
19+
npm init -y
20+
npm install @pythnetwork/per-sdk-solidity
21+
```
22+
23+
Then add the following line to your `remappings.txt` file:
24+
25+
```text
26+
@pythnetwork/per-sdk-solidity/=node_modules/@pythnetwork/per-sdk-solidity
27+
```
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[
2+
{
3+
"inputs": [
4+
{
5+
"internalType": "bytes",
6+
"name": "permissionKey",
7+
"type": "bytes"
8+
}
9+
],
10+
"name": "receiveAuctionProceedings",
11+
"outputs": [],
12+
"stateMutability": "payable",
13+
"type": "function"
14+
}
15+
]
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[
2+
{
3+
"inputs": [
4+
{
5+
"internalType": "address",
6+
"name": "protocol",
7+
"type": "address"
8+
},
9+
{
10+
"internalType": "bytes",
11+
"name": "permissionKey",
12+
"type": "bytes"
13+
}
14+
],
15+
"name": "isPermissioned",
16+
"outputs": [
17+
{
18+
"internalType": "bool",
19+
"name": "permissioned",
20+
"type": "bool"
21+
}
22+
],
23+
"stateMutability": "view",
24+
"type": "function"
25+
}
26+
]
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "@pythnetwork/per-sdk-solidity",
3+
"version": "0.1.0",
4+
"description": "Solidity SDK for interacting with Pyth express relay contracts",
5+
"repository": {
6+
"type": "git",
7+
"url": "https://github.com/pyth-network/pyth-crosschain",
8+
"directory": "express_relay/sdk/solidity"
9+
},
10+
"publishConfig": {
11+
"access": "public"
12+
},
13+
"scripts": {
14+
"format": "npx prettier --write .",
15+
"generate-abi": "npx generate-abis IPERMulticall IPERFeeReceiver",
16+
"check-abi": "git diff --exit-code abis"
17+
},
18+
"keywords": [
19+
"pyth",
20+
"oracle",
21+
"relay"
22+
],
23+
"author": "Douro Labs",
24+
"license": "Apache-2.0",
25+
"bugs": {
26+
"url": "https://github.com/pyth-network/pyth-crosschain/issues"
27+
},
28+
"homepage": "https://github.com/pyth-network/pyth-crosschain/tree/main/express_relay/sdk/solidity",
29+
"devDependencies": {
30+
"prettier": "^2.7.1",
31+
"prettier-plugin-solidity": "^1.0.0-rc.1",
32+
"abi_generator": "*"
33+
}
34+
}

0 commit comments

Comments
 (0)