|
Ran
|
Jobs
1
|
Files
39
|
Run time
1min
|
Badge
README BADGES
|
push
github
Add an agent NFT extension with ERC-8048 onchain metadata (#212) Adds `ERC721SeaDropAgents`, an extension for collections whose tokens are AI agents, modeled on what MUSEGOD's [Muses contract](https://robin.etherscan.io/address/0x13ea3072b#code) added to `ERC721SeaDrop` on Robinhood Chain. The ERC-8048 code is a separate module in `src/lib`, so other token contracts can reuse it. ## Agent registration `registerAgents(firstTokenId, lastTokenId, prefix, suffix)` registers an [ERC-8004](https://eips.ethereum.org/EIPS/eip-8004) agent for each token through an [ERC-8217](https://eips.ethereum.org/EIPS/eip-8217) adapter, with agent URI `prefix` + id + `suffix`. Whoever holds the token controls the agent. The adapter is a constructor argument, since it is only deployed on some networks. - Owner only, and only for tokens not minted yet (up to the max supply). The adapter lets a token contract register only tokens without an owner. MUSEGOD's version allowed it only before the first mint; this allows registering in ranges as a drop goes. - The adapter doesn't stop a token from being registered twice, so the contract records each agent id and skips tokens already registered. `agentOf(tokenId)` returns it. ## ERC-8048 onchain metadata `ERC8048OnchainMetadata` stores string keys with bytes values per token and implements ERC-8048's optional Metadata Authority extension in its collection-wide form ([ethereum/ERCs#2174](https://github.com/ethereum/ERCs/pull/2174)). The authority and three settings pack into one storage slot. - `tokenMetadataAuthority()` returns the one address that can write every token, including before mint, or zero when none is set. While it is set it is the only writer, as the ERC requires: the owner and holders write only through it. `supportsInterface(0x04f90b41)` returns true, and every change of the address emits `TokenMetadataAuthoritySet(address indexed authority)`. - While the authority is blank, the ... (continued)
250 of 338 branches covered (73.96%)
Branch coverage included in aggregate %.
169 of 174 new or added lines in 5 files covered. (97.13%)
1588 of 1880 relevant lines covered (84.47%)
1790.78 hits per line
| Lines | Coverage | ∆ | File |
|---|---|---|---|
| 3 |
85.0
|
test/foundry/ERC721SeaDropAgents.t.sol | |
| 2 |
73.68
|
src/test/MockAgentAdapter.sol |
| ID | Job ID | Ran | Files | Coverage | |
|---|---|---|---|---|---|
| 1 | foundry - 44153525429.1 | 39 |
82.87
|
GitHub Action Run |
| Coverage | ∆ | File | Lines | Relevant | Covered | Missed | Hits/Line | Branch Hits | Branch Misses |
|---|