# withdraw\_rewards

An entrypoint that updates users' global rewards. Also it updates the rewards of the user who wants to make a withdrawal. After all updates it executes a withdrawal of bakers' rewards for the specified user.

### Call parameters

```pascaligo
type withdraw_rewards_t is [@layout:comb] record [
  receiver                : contract(unit);
  user                    : address;
]
```

<table><thead><tr><th width="167.42422404731406">Field</th><th width="150">Type</th><th>Description</th></tr></thead><tbody><tr><td>receiver</td><td>contract(unit)</td><td>Receiver of TEZ tokens</td></tr><tr><td>user</td><td>address</td><td>User whose rewards need to be withdrawn</td></tr></tbody></table>

### Usage

Only [DexCore](https://docs.quipuswap.com/smart-contracts/dex-2.0/dexcore-contract) contract can call this entrypoint.

### Errors

* `403` - `sender` of the transaction is not [DexCore](https://docs.quipuswap.com/smart-contracts/dex-2.0/dexcore-contract) contract.
* `412` - non payable entrypoint (can't accept TEZ tokens during call of an entrypoint).
