Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,25 @@ $ yarn build

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Bonadocs Playground Setup

To set up and use the Bonadocs playground for interacting with Paycrest's gateway contract and APIs, follow these steps:

1. **Create a Bonadocs Playground**:
- Go to [Bonadocs](https://bonadocs.com) and create a new playground.
- Add both USDT and the gateway contract on the chains where the gateway is deployed.

2. **Add Bonadocs Actions**:
- Update the `docs/api.md` file to include Bonadocs actions for querying API endpoints using the `fetch` API in JavaScript.
- Update the `docs/contracts/Gateway.md` file to include Bonadocs actions for interacting with the gateway contract to create orders.

3. **Configure Docusaurus**:
- Update the `docusaurus.config.js` file to include Bonadocs playground configuration.

4. **Run the Playground**:
- Start the local development server using `yarn start`.
- Access the Bonadocs playground through the documentation site.

## Contributing

We welcome contributions to the Paycrest docs! To get started, follow these steps:
Expand Down
36 changes: 36 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ function App() {
}
```

<BonadocsWidget
widgetConfigUri="ipfs://QmNYcvyRbqTfTidr98gwJfhmh4mRZF4iWAvZSTNLsuu1M4"
contract="Gateway"
functionKey="0xf2507.function.0x809804f7"
/>

---

## Fetch Supported Institutions
Expand Down Expand Up @@ -140,6 +146,12 @@ function App() {
}
```

<BonadocsWidget
widgetConfigUri="ipfs://QmNYcvyRbqTfTidr98gwJfhmh4mRZF4iWAvZSTNLsuu1M4"
contract="Gateway"
functionKey="0xf2507.function.0x809804f7"
/>

---

## Verify Account
Expand Down Expand Up @@ -220,6 +232,12 @@ function App() {
}
```

<BonadocsWidget
widgetConfigUri="ipfs://QmNYcvyRbqTfTidr98gwJfhmh4mRZF4iWAvZSTNLsuu1M4"
contract="Gateway"
functionKey="0xf2507.function.0x809804f7"
/>

---

## Fetch Supported Currencies
Expand Down Expand Up @@ -299,6 +317,12 @@ function App() {
}
```

<BonadocsWidget
widgetConfigUri="ipfs://QmNYcvyRbqTfTidr98gwJfhmh4mRZF4iWAvZSTNLsuu1M4"
contract="Gateway"
functionKey="0xf2507.function.0x809804f7"
/>

---

## Fetch Payment Order by ID
Expand Down Expand Up @@ -401,6 +425,12 @@ function App() {
}
```

<BonadocsWidget
widgetConfigUri="ipfs://QmNYcvyRbqTfTidr98gwJfhmh4mRZF4iWAvZSTNLsuu1M4"
contract="Gateway"
functionKey="0xf2507.function.0x809804f7"
/>

---

## Fetch All Payment Orders
Expand Down Expand Up @@ -507,3 +537,9 @@ function App() {
);
}
```

<BonadocsWidget
widgetConfigUri="ipfs://QmNYcvyRbqTfTidr98gwJfhmh4mRZF4iWAvZSTNLsuu1M4"
contract="Gateway"
functionKey="0xf2507.function.0x809804f7"
/>
236 changes: 121 additions & 115 deletions docs/contracts/Gateway.md
Original file line number Diff line number Diff line change
@@ -1,115 +1,121 @@
# Gateway

This contract serves as a gateway for creating orders and managing settlements.

### fee

```solidity
struct fee {
uint256 protocolFee;
uint256 liquidityProviderAmount;
}
```

### constructor

```solidity
constructor() public
```

### initialize

<BonadocsWidget widgetConfigUri="ipfs://bafkreigu3fc74fxtt5slxaow52iuoe3iqnrkjoxnrx2fgoprwhu7c74p2m" contract="Gateway" functionKey="0x8129fc1c" />

Initialize function.

### onlyAggregator

```solidity
modifier onlyAggregator()
```

_Modifier that allows only the aggregator to call a function._

### pause

<BonadocsWidget widgetConfigUri="ipfs://bafkreigu3fc74fxtt5slxaow52iuoe3iqnrkjoxnrx2fgoprwhu7c74p2m" contract="Gateway" functionKey="0x8456cb59" />

Pause the contract.

### unpause

<BonadocsWidget widgetConfigUri="ipfs://bafkreigu3fc74fxtt5slxaow52iuoe3iqnrkjoxnrx2fgoprwhu7c74p2m" contract="Gateway" functionKey="0x3f4ba83a" />

Unpause the contract.

### createOrder

<BonadocsWidget
widgetConfigUri="ipfs://QmNYcvyRbqTfTidr98gwJfhmh4mRZF4iWAvZSTNLsuu1M4"
contract="Gateway"
functionKey="0xf2507.function.0x809804f7"
/>

See `{createOrder-IGateway}`.

### \_handler

```solidity
function _handler(address _token, uint256 _amount, address _refundAddress, address _senderFeeRecipient, uint256 _senderFee, bytes32 _institutionCode) internal view
```

Internal function to handle order creation.

#### Parameters

| Name | Type | Description |
| -------------------- | ------- | --------------------------------------------------------- |
| \_token | address | The address of the token being traded. |
| \_amount | uint256 | The amount of tokens being traded. |
| \_refundAddress | address | The address to refund the tokens in case of cancellation. |
| \_senderFeeRecipient | address | The address of the recipient for the sender fee. |
| \_senderFee | uint256 | The amount of the sender fee. |
| \_institutionCode | bytes32 | The code of the institution associated with the order. |

### settle

<BonadocsWidget widgetConfigUri="ipfs://bafkreigu3fc74fxtt5slxaow52iuoe3iqnrkjoxnrx2fgoprwhu7c74p2m" contract="Gateway" functionKey="0xf22ee704" />

See `{settle-IGateway}`.

### refund

<BonadocsWidget widgetConfigUri="ipfs://bafkreigu3fc74fxtt5slxaow52iuoe3iqnrkjoxnrx2fgoprwhu7c74p2m" contract="Gateway" functionKey="0x71eedb88" />

See `{refund-IGateway}`.

### getOrderInfo

<BonadocsWidget widgetConfigUri="ipfs://bafkreigu3fc74fxtt5slxaow52iuoe3iqnrkjoxnrx2fgoprwhu7c74p2m" contract="Gateway" functionKey="0x768c6ec0" />

See `{getOrderInfo-IGateway}`.

### isTokenSupported

<BonadocsWidget widgetConfigUri="ipfs://bafkreigu3fc74fxtt5slxaow52iuoe3iqnrkjoxnrx2fgoprwhu7c74p2m" contract="Gateway" functionKey="0x75151b63" />

See `{isTokenSupported-IGateway}`.

### getSupportedInstitutionByCode

<BonadocsWidget widgetConfigUri="ipfs://bafkreigu3fc74fxtt5slxaow52iuoe3iqnrkjoxnrx2fgoprwhu7c74p2m" contract="Gateway" functionKey="0xc2280103" />

See `{getSupportedInstitutionByCode-IGateway}`.

### getSupportedInstitutions

<BonadocsWidget widgetConfigUri="ipfs://bafkreigu3fc74fxtt5slxaow52iuoe3iqnrkjoxnrx2fgoprwhu7c74p2m" contract="Gateway" functionKey="0x02621338" />

See `{getSupportedInstitutions-IGateway}`.

### getFeeDetails

<BonadocsWidget widgetConfigUri="ipfs://bafkreigu3fc74fxtt5slxaow52iuoe3iqnrkjoxnrx2fgoprwhu7c74p2m" contract="Gateway" functionKey="0xb810c636" />

See `{getFeeDetails-IGateway}`.
# Gateway

This contract serves as a gateway for creating orders and managing settlements.

### fee

```solidity
struct fee {
uint256 protocolFee;
uint256 liquidityProviderAmount;
}
```

### constructor

```solidity
constructor() public
```

### initialize

<BonadocsWidget widgetConfigUri="ipfs://bafkreigu3fc74fxtt5slxaow52iuoe3iqnrkjoxnrx2fgoprwhu7c74p2m" contract="Gateway" functionKey="0x8129fc1c" />

Initialize function.

### onlyAggregator

```solidity
modifier onlyAggregator()
```

_Modifier that allows only the aggregator to call a function._

### pause

<BonadocsWidget widgetConfigUri="ipfs://bafkreigu3fc74fxtt5slxaow52iuoe3iqnrkjoxnrx2fgoprwhu7c74p2m" contract="Gateway" functionKey="0x8456cb59" />

Pause the contract.

### unpause

<BonadocsWidget widgetConfigUri="ipfs://bafkreigu3fc74fxtt5slxaow52iuoe3iqnrkjoxnrx2fgoprwhu7c74p2m" contract="Gateway" functionKey="0x3f4ba83a" />

Unpause the contract.

### createOrder

<BonadocsWidget
widgetConfigUri="ipfs://QmNYcvyRbqTfTidr98gwJfhmh4mRZF4iWAvZSTNLsuu1M4"
contract="Gateway"
functionKey="0xf2507.function.0x809804f7"
/>

See `{createOrder-IGateway}`.

### \_handler

```solidity
function _handler(address _token, uint256 _amount, address _refundAddress, address _senderFeeRecipient, uint256 _senderFee, bytes32 _institutionCode) internal view
```

Internal function to handle order creation.

#### Parameters

| Name | Type | Description |
| -------------------- | ------- | --------------------------------------------------------- |
| \_token | address | The address of the token being traded. |
| \_amount | uint256 | The amount of tokens being traded. |
| \_refundAddress | address | The address to refund the tokens in case of cancellation. |
| \_senderFeeRecipient | address | The address of the recipient for the sender fee. |
| \_senderFee | uint256 | The amount of the sender fee. |
| \_institutionCode | bytes32 | The code of the institution associated with the order. |

### settle

<BonadocsWidget widgetConfigUri="ipfs://bafkreigu3fc74fxtt5slxaow52iuoe3iqnrkjoxnrx2fgoprwhu7c74p2m" contract="Gateway" functionKey="0xf22ee704" />

See `{settle-IGateway}`.

### refund

<BonadocsWidget widgetConfigUri="ipfs://bafkreigu3fc74fxtt5slxaow52iuoe3iqnrkjoxnrx2fgoprwhu7c74p2m" contract="Gateway" functionKey="0x71eedb88" />

See `{refund-IGateway}`.

### getOrderInfo

<BonadocsWidget widgetConfigUri="ipfs://bafkreigu3fc74fxtt5slxaow52iuoe3iqnrkjoxnrx2fgoprwhu7c74p2m" contract="Gateway" functionKey="0x768c6ec0" />

See `{getOrderInfo-IGateway}`.

### isTokenSupported

<BonadocsWidget widgetConfigUri="ipfs://bafkreigu3fc74fxtt5slxaow52iuoe3iqnrkjoxnrx2fgoprwhu7c74p2m" contract="Gateway" functionKey="0x75151b63" />

See `{isTokenSupported-IGateway}`.

### getSupportedInstitutionByCode

<BonadocsWidget widgetConfigUri="ipfs://bafkreigu3fc74fxtt5slxaow52iuoe3iqnrkjoxnrx2fgoprwhu7c74p2m" contract="Gateway" functionKey="0xc2280103" />

See `{getSupportedInstitutionByCode-IGateway}`.

### getSupportedInstitutions

<BonadocsWidget widgetConfigUri="ipfs://bafkreigu3fc74fxtt5slxaow52iuoe3iqnrkjoxnrx2fgoprwhu7c74p2m" contract="Gateway" functionKey="0x02621338" />

See `{getSupportedInstitutions-IGateway}`.

### getFeeDetails

<BonadocsWidget widgetConfigUri="ipfs://bafkreigu3fc74fxtt5slxaow52iuoe3iqnrkjoxnrx2fgoprwhu7c74p2m" contract="Gateway" functionKey="0xb810c636" />

See `{getFeeDetails-IGateway}`.

<BonadocsWidget
widgetConfigUri="ipfs://QmNYcvyRbqTfTidr98gwJfhmh4mRZF4iWAvZSTNLsuu1M4"
contract="Gateway"
functionKey="0xf2507.function.0x809804f7"
/>
15 changes: 12 additions & 3 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @ts-check

import {themes as prismThemes} from 'prism-react-renderer';

/** @type {import('@docusaurus/types').Config} */
Expand Down Expand Up @@ -54,4 +52,15 @@ export default {
darkTheme: prismThemes.dracula,
},
},
};
plugins: [
[
'@docusaurus/plugin-content-docs',
{
id: 'bonadocs',
path: 'bonadocs',
routeBasePath: 'bonadocs',
sidebarPath: require.resolve('./sidebars.js'),
},
],
],
};