# Proton Contract

## Get Proton Info

> ***Get a Proton's creator, sale price, etc.***

### creatorOf

Gets the creator of a Proton.

```d
function creatorOf(
  uint256 tokenId
) external view virtual override returns (address);
```

| Parameter / Return Value | Description              |
| ------------------------ | ------------------------ |
| tokenId                  | id of Proton             |
| return                   | address of token creator |

### getSalePrice

Gets current sale price of a Proton in Ether.

```d
function getSalePrice(uint256 tokenId) 
  external 
  view
  virtual
  override
  returns (uint256);
```

| Parameter / Return Value | Description         |
| ------------------------ | ------------------- |
| tokenId                  | id of Proton        |
| return                   | sale price in Ether |

### getLastSellPrice

Gets most recent price that Proton sold for in Ether.

```d
function creatorOf(uint256 tokenId) 
  external
  view
  virtual
  override
  returns (address);
```

| Parameter / Return Value | Description         |
| ------------------------ | ------------------- |
| tokenId                  | id of Proton        |
| return                   | sale price in Ether |

### getCreatorRoyalties

Gets creator royalties for a given creator address. Royalties are how much of the sale price will be directed to the Proton's creator whenever a Proton is sold.

```d
function getCreatorRoyalties(
  address account
) external view virtual override returns (uint256);
```

| Parameter / Return Value | Description                          |
| ------------------------ | ------------------------------------ |
| address                  | creator account                      |
| return                   | royalties earned by creator (in ETH) |

### getCreatorRoyaltiesPct

Gets creator royalties for a given tokenId. Royalties are how much of the sale price will be directed to the Proton's creator whenever a Proton is sold.

```d
function getCreatorRoyaltiesPct(
  uint256 tokenId
) external view virtual override returns (uint256);
```

| Parameter / Return Value | Description                       |
| ------------------------ | --------------------------------- |
| tokenId                  | id of Proton                      |
| return                   | royalty percentage on Proton sale |

### getCreatorRoyaltiesReceiver

Gets creator royalties receiver. Can be either the creator or a 3rd-party, such as a charity, relative, or any other account of choice.

```d
function getCreatorRoyaltiesReceiver(
  uint256 tokenId
) external view virtual override returns (address);
```

| Parameter / Return Value | Description                   |
| ------------------------ | ----------------------------- |
| tokenId                  | id of Proton                  |
| return                   | address of royalties receiver |

## Create & Interact with Proton(s)

> ***Create various types of Protons, buy a Proton, claim royalties, etc.***

### claimCreatorRoyalties

Sends royalties to creator or delegated receiver.

```d
function claimCreatorRoyalties() 
  external 
  virtual
  override
  nonReentrant
  whenNotPaused
  returns (uint256)
```

<table><thead><tr><th width="294">Parameter / Return Value</th><th>Description</th></tr></thead><tbody><tr><td>Parameter / Return Value</td><td>Description</td></tr><tr><td>amount</td><td>amount claimed in ETH</td></tr></tbody></table>

### createChargedParticle

Create a new Charged Particle (a Proton with interest-bearing assets deposited into its wallet).

```d
function createChargedParticle(
  address creator,
  address receiver,
  address referrer,
  string tokenMetaUri,
  string walletManagerId,
  address assetToken,
  uint256 assetAmount, 
  uint256 annuityPercent
) external virtual override nonReentrant whenNotPaused returns (uint256 newTokenId);
```

| Parameter / Return Value | Description                                                                                                                                                                    |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| creator                  | id of Charged Particle                                                                                                                                                         |
| receiver                 | receiver of new Charged Particle                                                                                                                                               |
| referrer                 | \*used for an internal feature that has yet to be implemented -- ignore                                                                                                        |
| tokenMetaUri             | URI of tokenmetadata                                                                                                                                                           |
| walletManagerId          | id of wallet manager for ERC20 being deposited upon mint                                                                                                                       |
| assetToken               | asset to create token with                                                                                                                                                     |
| assetAmount              | amount of asset token to deposit                                                                                                                                               |
| annuityPercent           | <p>percentage of charge (interest) directed to creator, in <a href="https://www.investopedia.com/terms/b/basispoint.asp">basis points</a></p><p></p><p>e.g. '10000' = 100%</p> |
| newTokenId               | id of new Charged Particle                                                                                                                                                     |

### createBasicProton

Create a basic Proton without charge, and with annuityPercent, royaltiesPercent, and salePrice set to 0.

```d
function createBasicProton(
  address creator,
  address receiver,
  string tokenMetaUri
) external virtual override whenNotPaused returns (uint256 newTokenId);
```

| Parameter / Return Value | Description             |
| ------------------------ | ----------------------- |
| creator                  | id of Proton            |
| receiver                 | receiver of new Proton  |
| tokenMetaUri             | URI of token's metadata |
| newTokenId               | id of new Proton        |

### createProton

Create a Proton, set its annuity percentage to a custom amount, and set royalties percentage and salePrice to 0.

```d
function createProton(
  address creator,
  address receiver,
  string tokenMetaUri,
  uint256 annuityPercent
) external virtual override whenNotPaused returns (uint256 newTokenId);
```

| Parameter / Return Value | Description                                 |
| ------------------------ | ------------------------------------------- |
| creator                  | address of creator                          |
| receiver                 | receiver of new Proton                      |
| tokenMetaUri             | URI of tokenmetadata                        |
| annuity percent          | percentage of interest that goes to creator |
| newTokenId               | id of new Proton                            |

### createProtonForSale

```d
function createProtonForSale(
  address creator,
  address receiver,
  string tokenMetaUri,
  uint256 annuityPercent,
  uint256 royaltiesPercent,
  uint256 salePrice
) external virtual override whenNotPaused returns (uint256 newTokenId);
```

| Parameter / Return Value | Description                                          |
| ------------------------ | ---------------------------------------------------- |
| creator                  | address of creator                                   |
| receiver                 | receiver of new Proton                               |
| tokenMetaUri             | URI of tokenmetadata                                 |
| annuityPercent           | percentage of charge (interest) that goes to creator |
| royaltiesPercent         | percentage of Proton sale that goes to creator       |
| salePrice                | sale price of Proton                                 |
| newTokenId               | id of new Proton                                     |

### batchProtonsForSale

```d
function batchProtonsForSale(
  address creator,
  uint256 annuityPercent,
  uint256 royaltiesPercent,
  string[] calldata tokenMetaUris,
  uint256[] calldata salePrices
) external virtual override whenNotPaused;
```

| Parameter / Return Value | Description                                          |
| ------------------------ | ---------------------------------------------------- |
| creator                  | address of creator                                   |
| annuityPercent           | percentage of charge (interest) that goes to creator |
| royaltiesPercent         | percentage of Proton sale that goes to creator       |
| tokenMetaUris            | array of token metadata URIs for Protons             |
| salePrices               | array of sale prices for Protons                     |

### buyProton

Buy a Proton.

```d
function buyProton(
  uint256 tokenId
) external payable virutal override nonReentrant whenNotPaused returns (bool);
```

| Parameter / Return Value | Description                               |
| ------------------------ | ----------------------------------------- |
| tokenId                  | id of Proton to purchase                  |
| return                   | true if purchase successful, false if not |

## Update Proton Settings (Only for Creator/Owner)

> ***Set a Protons Price, Royalties, or Royalties Receiver.***

### setSalePrice

Set the sale price for a Proton.

```d
function setSalePrice(
  uint256 tokenId, 
  uint256 salePrice
) external virtual override whenNotPaused onlyTokenOwnerOrApproved(tokenId);
```

| Parameter / Return Value | Description                   |
| ------------------------ | ----------------------------- |
| tokenId                  | id of Proton to set price for |
| salePrice                | sale price in Ether           |

### setRoyaltiesPct

Set royalties percentage for a Proton.

```d
function setRoyaltiesPct(
  uint256 tokenId,
  uint256 royaltiesPct
) external virtual override whenNotPaused onlyTokenCreator(tokenId) onlyTokenOwnerOrApproved(tokenId);
```

| Parameter / Return Value | Description                            |
| ------------------------ | -------------------------------------- |
| tokenId                  | id of Proton to set price for          |
| royaltiesPct             | percentage of sale directed to creator |

### setCreatorRoyaltiesReceiver

Set a receiver for Proton royalties.

```d
function setCreatorRoyaltiesReceiver(
  uint256 tokenId, 
  address receiver
) external virtual override whenNotPaused onlyTokenCreator(tokenId);
```

| Parameter / Return Value | Description                     |
| ------------------------ | ------------------------------- |
| tokenId                  | id of Proton to set recever for |
| receiver                 | address of receiver             |

## Other

### Events

**UniverseSet**

```erlang
event UniverseSet(address indexed universe);
```

**ChargedStateSet**

```erlang
event ChargedStateSet(address indexed chargedState);
```

**ChargedSettingsSet**

```erlang
event ChargedSettingsSet(address indexed chargedSettings);
```

**ChargedParticlesSet**

```erlang
event ChargedParticlesSet(address indexed chargedParticles);
```

**PausedStateSet**

```erlang
event PausedStateSet(bool isPaused);
```

**SalePriceSet**

```erlang
event SalePriceSet(uint256 indexed tokenId, uint256 salePrice);
```

**CreatorRoyaltiesSet**

```erlang
event CreatorRoyaltiesSet(uint256 indexed tokenId, uint256 royaltiesPct);
```

**FeesWithdrawn**

```erlang
event FeesWithdrawn(address indexed receiver, uint256 amount);
```

**ProtonSold**

```erlang
event ProtonSold(
  uint256 indexed tokenId,
  address indexed oldOwner,
  address indexed newOwner,
  uint256 salePrice,
  address creator, 
  uint256 creatorRoyalties
);
```

**RoyaltiesClaimed**

```erlang
event RoyaltiesClaimed(address indexed receiver, uint256 amountClaimed);
```


---

# Agent Instructions: 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:

```
GET https://docs.charged.fi/charged-particles-protocol/developing-on-the-protocol/smart-contracts/v1/proton-contract.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
