> For the complete documentation index, see [llms.txt](https://docs.symm.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.symm.io/contract-documentation/symmio-perps-v0.8.5/diamond-core-facets/pledge.md).

# Pledge

The Pledge Facet manages pledge collateral, a separate collateral pool that PartyBs deposit as a guarantee of good behavior. Pledge collateral is independent of the trading collateral used for positions and serves as a "skin in the game" mechanism. If a PartyB acts maliciously (e.g., abuses the Auto Deleveraging system by closing positions at unfair prices), their pledge can be slashed by an admin. The underlying logic is implemented in the `PledgeFacetImpl` library.

Pledge collateral is primarily used as a penalty mechanism for ADL (Auto-Deleveraging). Before enabling ADL for a PartyB via `ControlFacet.setADLEnabled`, they should have deposited sufficient pledge collateral. This ensures PartyBs are incentivized to use ADL fairly.

***

#### Overview

The Pledge Facet provides the following functionality:

* **Deposit Pledge:** PartyB deposits pledge collateral in any ERC-20 token.
* **Request Pledge Withdrawal:** PartyB requests to withdraw pledge collateral, subject to admin approval.
* **Cancel Pledge Withdrawal:** PartyB cancels a pending withdrawal request.
* **Accept Pledge Withdrawal:** Admin approves a pending withdrawal, transferring funds to the requested recipient.
* **Slash Pledge:** Admin deducts pledge collateral as a penalty and redirects it to a specified recipient.

***

#### depositPledge()

Deposits pledge collateral for the caller. Any ERC-20 token can be used. Amounts are in the token's native decimals (not normalized to 18 decimals).

**Function Signature:**

```solidity
function depositPledge(address token, uint256 amount) external whenNotAccountingPaused notSuspended(signer);
```

**Parameters:**

* `token`: The ERC-20 token address to deposit.
* `amount`: The amount to deposit (in the token's native decimals).

**Events Emitted:**

* `PledgeCollateralDeposited(address partyB, address token, uint256 amount)`

***

#### requestPledgeWithdraw()

Requests withdrawal of pledge collateral to a specified recipient. The withdrawal is not immediate. It requires admin approval via `acceptPledgeWithdraw`. This two-step flow prevents PartyBs from quickly withdrawing pledge before a slashing can be applied.

Only one withdrawal request can be pending at a time per PartyB.

**Function Signature:**

```solidity
function requestPledgeWithdraw(address token, uint256 amount, address recipient) external whenNotAccountingPaused notSuspended(signer);
```

**Parameters:**

* `token`: The ERC-20 token to withdraw.
* `amount`: The amount to withdraw (in the token's native decimals).
* `recipient`: The address that will receive the funds if the withdrawal is approved.

**Events Emitted:**

* `PledgeWithdrawRequested(address partyB, address token, uint256 amount, address recipient)`

***

#### cancelPledgeWithdraw()

Cancels a pending pledge withdrawal request.

**Function Signature:**

```solidity
function cancelPledgeWithdraw() external whenNotAccountingPaused notSuspended(signer);
```

**Events Emitted:**

* `PledgeWithdrawCancelled(address partyB, address token, uint256 amount)`

***

#### acceptPledgeWithdraw()

Approves a pending pledge withdrawal and transfers the funds to the recipient specified in the original request.

**Function Signature:**

```solidity
function acceptPledgeWithdraw(address user, uint256 amount, address token) external whenNotAccountingPaused onlyRole(PARTY_B_MANAGER_ROLE);
```

**Parameters:**

* `user`: The PartyB whose withdrawal request is being approved.
* `amount`: The amount to withdraw (must match the request).
* `token`: The ERC-20 token to withdraw (must match the request).

**Access:** Requires `PARTY_B_MANAGER_ROLE`.

**Events Emitted:**

* `PledgeWithdrawApproved(address partyB, address token, uint256 amount)`

***

#### slashPledge()

Slashes a PartyB's pledge collateral as a penalty and transfers the deducted amount to a specified recipient. This is used when a PartyB misbehaves, for example by abusing ADL to close positions at prices that unfairly harm PartyA.

**Function Signature:**

```solidity
function slashPledge(address user, address token, uint256 amount, address recipient) external whenNotAccountingPaused onlyRole(PARTY_B_MANAGER_ROLE);
```

**Parameters:**

* `user`: The PartyB being penalized.
* `token`: The ERC-20 token to deduct.
* `amount`: The penalty amount (in the token's native decimals).
* `recipient`: The address receiving the penalty funds.

**Access:** Requires `PARTY_B_MANAGER_ROLE`.

**Events Emitted:**

* `UserSlashed(address partyB, address token, uint256 amount, address recipient)`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.symm.io/contract-documentation/symmio-perps-v0.8.5/diamond-core-facets/pledge.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
