|
1 | 1 | # Permissionin ID
|
2 | 2 |
|
3 |
| -`permissionId` is a `bytes` object that represents the unique identifying information of a position within the protocol. `permissionId` allows the system to distinguish between bids competing on different opportunities and thereby run more scoped and efficient auctions. |
| 3 | +`permissionId` is a `bytes` object that represents the unique identifying information of a position within the protocol. `PermissionId` allows the system to distinguish between bids competing on different opportunities and thereby run more scoped and efficient auctions. |
4 | 4 |
|
5 |
| -For some protocols, each borrower has a unique position, so the borrower address uniquely identifies a position. For other protocols, each borrower might have multiple positions, distinguished by the address of the collateral asset or by a uint256 id number. In those cases, the set of information that uniquely identifies a position would include multiple fields. |
| 5 | +Each borrower has a unique position for some protocols, so the borrower address uniquely identifies a position. |
| 6 | +Whereas in some protocols, each borrower might have multiple positions, distinguished by the address of the collateral asset or by a `uint256` ID number. |
| 7 | +In those cases, the information set that uniquely identifies a position would include multiple fields. |
6 | 8 |
|
7 |
| -`permissionId` is the concatenation of all these fields in bytes format. To concatenate these fields together, you can call `abi.encode()`. For example, if a protocol featured a unique position per borrower, then it could form `permissionId` as |
| 9 | +`permissionId` is the concatenation of all these fields in bytes format. You can call `abi.encode(){:solidity}` to concatenate these fields together. |
8 | 10 |
|
9 |
| -``` |
| 11 | +For example, if a protocol featured a unique position per borrower, then it could form `permissionId` as |
| 12 | + |
| 13 | +```solidity |
10 | 14 | bytes memory permissionId = abi.encode(borrowerAddress);
|
11 | 15 | ```
|
12 | 16 |
|
13 |
| -On the other hand, if a protocol allowed a borrower to open as many new positions as they wanted, denoted by an identifier `uint256 positionId`, then it could form permissionId as |
14 | 17 |
|
15 |
| -``` |
| 18 | +On the other hand, if a protocol allowed a borrower to open as many new positions as they wanted, denoted by an identifier `uint256 positionId{:solidity}`, then it could form `permissionId` as |
| 19 | + |
| 20 | +```solidity |
16 | 21 | bytes memory permissionId = abi.encode(borrowerAddress, positionId);
|
17 | 22 | ```
|
18 | 23 |
|
19 |
| -The `permissionId` is used in the `ExpressRelay` contract to toggle permissions for interacting with the protocol. This toggling is checked within the protocol's code to ensure that the current transaction is within the context of Express Relay, so that recaptured value can be returned to the protocol. |
| 24 | +The Express Relay contract uses the `permissionId` to toggle permissions for interacting with the protocol. |
| 25 | +This toggling is checked within the protocol's code to ensure that the current transaction is within the context of Express Relay so that the recaptured value can be returned to the protocol. |
0 commit comments