-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add: contract and abi #15
Merged
Merged
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ece1f34
add: contract and abi
juroberttyb 4a42a6f
update: deployed contract address at optimism sepolia
juroberttyb 9c4cb25
Update smart-contracts/dao.sol
juroberttyb 3a1ca10
add: new possible deploy targets
juroberttyb d77c29b
Update smart-contracts/dao.sol
juroberttyb 4a11d2e
Update smart-contracts/dao.sol
juroberttyb cc63cf5
update: rm constructor and update var naming
juroberttyb b66fd6e
update: var naming
juroberttyb fe09a9c
add: todo list in readme
juroberttyb 8444fc7
update: todo list
juroberttyb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
### TODO | ||
- hardhat deploy script | ||
- unit test | ||
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,192 @@ | ||
[ | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "address", | ||
"name": "member", | ||
"type": "address" | ||
} | ||
], | ||
"name": "addMember", | ||
"outputs": [], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "string", | ||
"name": "role", | ||
"type": "string" | ||
} | ||
], | ||
"name": "addRole", | ||
"outputs": [], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "address", | ||
"name": "ratee", | ||
"type": "address" | ||
}, | ||
{ | ||
"internalType": "string", | ||
"name": "role", | ||
"type": "string" | ||
}, | ||
{ | ||
"internalType": "address", | ||
"name": "rater", | ||
"type": "address" | ||
}, | ||
{ | ||
"internalType": "uint8", | ||
"name": "value", | ||
"type": "uint8" | ||
} | ||
], | ||
"name": "rateMember", | ||
"outputs": [], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"stateMutability": "nonpayable", | ||
"type": "constructor" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "getMembersCount", | ||
"outputs": [ | ||
{ | ||
"internalType": "uint256", | ||
"name": "", | ||
"type": "uint256" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "getRolesCount", | ||
"outputs": [ | ||
{ | ||
"internalType": "uint256", | ||
"name": "", | ||
"type": "uint256" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "string", | ||
"name": "", | ||
"type": "string" | ||
} | ||
], | ||
"name": "hasRole", | ||
"outputs": [ | ||
{ | ||
"internalType": "bool", | ||
"name": "", | ||
"type": "bool" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "address", | ||
"name": "", | ||
"type": "address" | ||
} | ||
], | ||
"name": "isMember", | ||
"outputs": [ | ||
{ | ||
"internalType": "bool", | ||
"name": "", | ||
"type": "bool" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "uint256", | ||
"name": "", | ||
"type": "uint256" | ||
} | ||
], | ||
"name": "members", | ||
"outputs": [ | ||
{ | ||
"internalType": "address", | ||
"name": "", | ||
"type": "address" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "address", | ||
"name": "", | ||
"type": "address" | ||
}, | ||
{ | ||
"internalType": "string", | ||
"name": "", | ||
"type": "string" | ||
}, | ||
{ | ||
"internalType": "address", | ||
"name": "", | ||
"type": "address" | ||
} | ||
], | ||
"name": "rates", | ||
"outputs": [ | ||
{ | ||
"internalType": "uint8", | ||
"name": "", | ||
"type": "uint8" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "uint256", | ||
"name": "", | ||
"type": "uint256" | ||
} | ||
], | ||
"name": "roles", | ||
"outputs": [ | ||
{ | ||
"internalType": "string", | ||
"name": "", | ||
"type": "string" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
} | ||
] |
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,47 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
|
||
pragma solidity ^0.8.19; | ||
|
||
contract Dao { | ||
// dao member => role => rater => rate | ||
mapping(address => mapping(string => mapping(address => uint8))) public ratings; | ||
|
||
// all members of the dao | ||
address[] public members; | ||
mapping(address => bool) public isMember; | ||
|
||
// roles of a given dao member | ||
string[] public roles; | ||
mapping(string => bool) public roleExists; | ||
|
||
function addMember(address member) public { | ||
if (isMember[member] == false) { | ||
isMember[member] = true; | ||
members.push(member); | ||
} | ||
juroberttyb marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
function addRole(string memory role) public { | ||
if (roleExists[role] == false) { | ||
roleExists[role] = true; | ||
roles.push(role); | ||
} | ||
} | ||
|
||
function rateMember(address ratee, string memory role, address rater, uint8 rating) public { | ||
ratings[ratee][role][rater] = rating; | ||
} | ||
|
||
// Function to get the length of members array | ||
function getMembersCount() public view returns (uint256) { | ||
return members.length; | ||
} | ||
|
||
// Function to get the length of roles array | ||
function getRolesCount() public view returns (uint256) { | ||
return roles.length; | ||
} | ||
} | ||
|
||
|
||
|
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"ContractName1": "0x...", | ||
"dao_contract": "0x43A30DB2d6962c37a702E869FbD15cFc4f86f621", | ||
"ContractName2": "0x..." | ||
} |
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,4 @@ | ||
{ | ||
"ContractName1": "0x...", | ||
"ContractName2": "0x..." | ||
} |
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,4 @@ | ||
{ | ||
"ContractName1": "0x...", | ||
"ContractName2": "0x..." | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TODO list mentions the need for a hardhat deploy script and unit tests.
Would you like assistance in implementing these tasks? Additionally, it might be beneficial to open GitHub issues to track the progress of these tasks. Shall I proceed with creating them?