Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
TomiOhl committed Apr 19, 2024
1 parent 4ecf4fb commit de9aab1
Show file tree
Hide file tree
Showing 7 changed files with 686 additions and 10 deletions.
4 changes: 2 additions & 2 deletions docs/contracts/BasicGuildRewardNFT.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ function hasTheUserIdClaimed(
) external returns (bool claimed)
```

Whether a userId has minted a token.
Whether a userId has claimed a token.

Used to prevent double mints in the same block.
Used to prevent double claims in the same block.

#### Parameters

Expand Down
195 changes: 195 additions & 0 deletions docs/contracts/ConfigurableGuildRewardNFT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
# ConfigurableGuildRewardNFT

An NFT distributed as a reward for Guild.xyz users.

## Variables

### factoryProxy

```solidity
address factoryProxy
```

The address of the proxy to be used when interacting with the factory.

_Used to access the factory's address when interacting through minimal proxies._

#### Return Values

| Name | Type | Description |
| ---- | ---- | ----------- |

### mintableAmountPerUser

```solidity
uint256 mintableAmountPerUser
```

The maximum amount of tokens a Guild user can claim from the token.

_Doesn't matter if they are claimed in the same transaction or separately._

#### Return Values

| Name | Type | Description |
| ---- | ---- | ----------- |

### cid

```solidity
string cid
```

The cid for tokenURI.

### claimedTokens

```solidity
mapping(uint256 => uint256) claimedTokens
```

The number of claimed tokens by userIds.

## Functions

### initialize

```solidity
function initialize(
struct IGuildRewardNFTFactory.ConfigurableNFTConfig nftConfig,
address factoryProxyAddress
) public
```

Sets metadata and the associated addresses.

Initializer function callable only once.

#### Parameters

| Name | Type | Description |
| :--- | :--- | :---------- |
| `nftConfig` | struct IGuildRewardNFTFactory.ConfigurableNFTConfig | See struct ConfigurableNFTConfig in IGuildRewardNFTFactory. |
| `factoryProxyAddress` | address | The address of the factory. |

### claim

```solidity
function claim(
uint256 amount,
address receiver,
uint256 userId,
bytes signature
) external
```

Claims tokens to the given address.

#### Parameters

| Name | Type | Description |
| :--- | :--- | :---------- |
| `amount` | uint256 | The amount of tokens to mint. Should be less or equal to mintableAmountPerUser. |
| `receiver` | address | The address that receives the token. |
| `userId` | uint256 | The id of the user on Guild. |
| `signature` | bytes | The following signed by validSigner: amount, receiver, userId, chainId, the contract's address. |

### burn

```solidity
function burn(
uint256[] tokenIds,
uint256 userId,
bytes signature
) external
```

Burns tokens from the sender.

#### Parameters

| Name | Type | Description |
| :--- | :--- | :---------- |
| `tokenIds` | uint256[] | The tokenIds to burn. All of them should belong to userId. |
| `userId` | uint256 | The id of the user on Guild. |
| `signature` | bytes | The following signed by validSigner: amount, receiver, userId, chainId, the contract's address. |

### updateTokenURI

```solidity
function updateTokenURI(
string newCid
) external
```

Updates the cid for tokenURI.

Only callable by the owner.

#### Parameters

| Name | Type | Description |
| :--- | :--- | :---------- |
| `newCid` | string | The new cid that points to the updated image. |

### balanceOf

```solidity
function balanceOf(
uint256 userId
) external returns (uint256 amount)
```

Returns the number of tokens the user claimed.

Analogous to balanceOf(address), but works with Guild user ids.

#### Parameters

| Name | Type | Description |
| :--- | :--- | :---------- |
| `userId` | uint256 | The id of the user on Guild. |

#### Return Values

| Name | Type | Description |
| :--- | :--- | :---------- |
| `amount` | uint256 | The number of tokens the userId has claimed. |
### tokenURI

```solidity
function tokenURI(
uint256 tokenId
) public returns (string)
```

See {IERC721Metadata-tokenURI}.

#### Parameters

| Name | Type | Description |
| :--- | :--- | :---------- |
| `tokenId` | uint256 | |

### isValidSignature

```solidity
function isValidSignature(
uint256 amount,
address receiver,
uint256 userId,
bytes signature
) internal returns (bool)
```

Checks the validity of the signature for the given params.

#### Parameters

| Name | Type | Description |
| :--- | :--- | :---------- |
| `amount` | uint256 | |
| `receiver` | address | |
| `userId` | uint256 | |
| `signature` | bytes | |

16 changes: 16 additions & 0 deletions docs/contracts/GuildRewardNFTFactory.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,22 @@ Deploys a minimal proxy for a basic NFT.
| `tokenTreasury` | address payable | The address that will collect the prices of the minted deployed tokens. |
| `tokenFee` | uint256 | The price of every mint in wei. |

### deployConfigurableNFT

```solidity
function deployConfigurableNFT(
struct IGuildRewardNFTFactory.ConfigurableNFTConfig nftConfig
) external
```

Deploys a minimal proxy for a configurable NFT.

#### Parameters

| Name | Type | Description |
| :--- | :--- | :---------- |
| `nftConfig` | struct IGuildRewardNFTFactory.ConfigurableNFTConfig | The config to initialize the token to be deployed with. |

### setNFTImplementation

```solidity
Expand Down
12 changes: 6 additions & 6 deletions docs/contracts/interfaces/IBasicGuildRewardNFT.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ function hasTheUserIdClaimed(
) external returns (bool claimed)
```

Whether a userId has minted a token.
Whether a userId has claimed a token.

Used to prevent double mints in the same block.
Used to prevent double claims in the same block.

#### Parameters

Expand Down Expand Up @@ -87,10 +87,10 @@ Initializer function callable only once.
| :--- | :--- | :---------- |
| `name` | string | The name of the token. |
| `symbol` | string | The symbol of the token. |
| `cid` | string | The cid used to construct the tokenURI for the token to be minted. |
| `tokenOwner` | address | The address that will be the owner of the deployed token. |
| `cid` | string | The cid used to construct the tokenURI for the token to be deployed. |
| `tokenOwner` | address | The address that will be the owner of the token. |
| `treasury` | address payable | The address that will receive the price paid for the token. |
| `tokenFee` | uint256 | The price of every mint in wei. |
| `tokenFee` | uint256 | The price of every claim in wei. |
| `factoryProxyAddress` | address | The address of the factory. |

### claim
Expand Down Expand Up @@ -202,7 +202,7 @@ Error thrown when an incorrect amount of fee is attempted to be paid.
| Name | Type | Description |
| ---- | ---- | ----------- |
| paid | uint256 | The amount of funds received. |
| requiredAmount | uint256 | The amount of fees required for minting. |
| requiredAmount | uint256 | The amount of fees required for claiming. |

### IncorrectSender

Expand Down
Loading

0 comments on commit de9aab1

Please sign in to comment.