Skip to content

Commit

Permalink
Gabriel/new deployment agent comm (#22)
Browse files Browse the repository at this point in the history
* New deployment with updated treasury

* settable treasury contract
  • Loading branch information
gabrielfior authored Jan 16, 2025
1 parent 874730a commit cf16bde
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Repository holding the contracts made by Gnosis Labs team.
| OmenThumbnailMapping | Manages IPFS hashes for market thumbnails on Omen 2.0 | [0xe0cf08311F03850497B0ed6A2cf067f1750C3eFc](https://gnosisscan.io/address/0xe0cf08311f03850497b0ed6a2cf067f1750c3efc#code) | [omen-thumbnailmapping](https://thegraph.com/studio/subgraph/omen-thumbnailmapping/) |
| OmenAgentResultMapping | Maps prediction results to markets on Omen 2.0 | [0xbe1F6944496923683ca849fc0cC93fD10523cB83](https://gnosisscan.io/address/0x260E1077dEA98e738324A6cEfB0EE9A272eD471a#code) | [omen-agentresultmapping](https://thegraph.com/studio/subgraph/omen-agentresultmapping/) |
| Agent NFT | Agent NFTs that control mechs for NFT game | [0x0D7C0Bd4169D090038c6F41CFd066958fe7619D0](https://gnosisscan.io/address/0x0D7C0Bd4169D090038c6F41CFd066958fe7619D0#code) | |
| Agent communication contract | Simple contract storing message queue for each agent | [0xd422e0059ed819e8d792af936da206878188e34f](https://gnosisscan.io/address/0xd422e0059ed819e8d792af936da206878188e34f#code) | |
| Agent communication contract | Simple contract storing message queue for each agent | [0xc566Cb829Ed7aC097D17a38011A40Ad2DC25Dd82](https://gnosisscan.io/address/0xc566Cb829Ed7aC097D17a38011A40Ad2DC25Dd82#code) | |
| Simple Treasury contract | Contract for storing the NFT agent game treasury | [0x624ad0db52e6b18afb4d36b8e79d0c2a74f3fc8a](https://gnosisscan.io/address/0x624ad0db52e6b18afb4d36b8e79d0c2a74f3fc8a#code) | |

## Set up contracts development
Expand Down
4 changes: 4 additions & 0 deletions src/NFT/AgentCommunication.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ contract AgentCommunication is Ownable {
_;
}

function setTreasuryAddress(address payable _treasury) public onlyOwner {
treasury = _treasury;
}

function adjustMinimumValueForSendingMessage(uint256 newValue) public onlyOwner {
minimumValueForSendingMessageInWei = newValue;
}
Expand Down
22 changes: 22 additions & 0 deletions test/AgentCommunication.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,26 @@ contract AgentCommunicationTest is Test {
uint256 messageCount = agentComm.countMessages(agent);
assertEq(messageCount, 2, "The message count should be 2");
}

function testSetTreasuryAddress() public {
address payable newTreasury = payable(address(0xabc));
vm.startPrank(owner);
agentComm.setTreasuryAddress(newTreasury);
vm.stopPrank();
assertEq(address(agentComm.treasury()), address(newTreasury));
}

function testOnlyOwnerCanSetTreasuryAddress() public {
address payable newTreasury = payable(address(0xabc));
address nonOwner = address(0xdef);

// Attempt to set treasury address from a non-owner address
vm.startPrank(nonOwner);
vm.expectRevert(abi.encodeWithSelector(Ownable.OwnableUnauthorizedAccount.selector, address(nonOwner)));
agentComm.setTreasuryAddress(newTreasury);
vm.stopPrank();

// Verify that the treasury address has not changed
assertEq(address(agentComm.treasury()), address(treasury));
}
}

0 comments on commit cf16bde

Please sign in to comment.