-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
686 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.