Skip to content
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

for publish #485

Merged
merged 13 commits into from
Mar 29, 2024
13 changes: 13 additions & 0 deletions apps/moloch-v3-subgraph/src/poster-mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { constants } from './util/constants';
import {
hasDaoDatabaseFields,
isDaoSafe,
isDaoShaman,
isMember,
isShareholder,
} from './util/validators';
Expand All @@ -28,6 +29,7 @@ export function handleNewPost(event: NewPost): void {
constants.DAOHAUS_PROPOSAL_DATABASE,
constants.DAOHAUS_SHARES_DATABASE,
constants.DAOHAUS_MEMBER_DATABASE,
constants.DAOHAUS_SHAMAN_DATABASE,
];
const validTag = validTags.includes(event.params.tag.toHexString());
if (!validTag) {
Expand Down Expand Up @@ -116,4 +118,15 @@ export function handleNewPost(event: NewPost): void {
addTransaction(event.block, event.transaction, event.address);
return;
}

if (
event.params.tag.toHexString() == constants.DAOHAUS_SHAMAN_DATABASE &&
hasDaoDatabaseFields(object) &&
isDaoShaman(object, event.params.user)
) {
log.info('&&& creating database record', [event.params.content]);
createDaoDatabaseRecord(object, event);
addTransaction(event.block, event.transaction, event.address);
return;
}
}
3 changes: 3 additions & 0 deletions apps/moloch-v3-subgraph/src/util/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,7 @@ export namespace constants {
//daohaus.member.database
export const DAOHAUS_MEMBER_DATABASE =
'0x3577aebf71d9bfbe235b0b98b53c9f1865b0f0dc68290b2b64c6251dc4de7800';
//daohaus.shaman.database
export const DAOHAUS_SHAMAN_DATABASE =
'0x28669a2d28b687eb592c45bf97b13239758e5d93354d383b83d2c2c51afaf4fe';
}
32 changes: 31 additions & 1 deletion apps/moloch-v3-subgraph/src/util/validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
log,
TypedMap,
} from '@graphprotocol/graph-ts';
import { Dao, Member } from '../../generated/schema';
import { Dao, Member, Shaman } from '../../generated/schema';
import { constants } from './constants';
import { getStringFromJson } from './parser';

Expand Down Expand Up @@ -65,6 +65,36 @@ export function isMember(
return true;
}

export function isDaoShaman(
object: TypedMap<string, JSONValue>,
senderAddress: Bytes
): boolean {
const daoId = getStringFromJson(object, 'daoId');
if (daoId.error != 'none') {
log.error('no table', []);
return false;
}

const shamanId = daoId.data
.concat('-shaman-')
.concat(senderAddress.toHexString());

const shaman = Shaman.load(shamanId);
if (!shaman) {
log.info('no shaman', []);

return false;
}

if (shaman.permissions == constants.BIGINT_ZERO) {
log.info('shaman has been disabled', []);

return false;
}

return true;
}

export function isDaoSafe(
object: TypedMap<string, JSONValue>,
senderAddress: Bytes
Expand Down
42 changes: 21 additions & 21 deletions apps/moloch-v3-subgraph/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ schema:
dataSources:
- kind: ethereum/contract
name: BaalSummonerV2
network: base
network: sepolia
source:
address: '0x22e0382194AC1e9929E023bBC2fD2BA6b778E098'
address: '0xB2B3909661552942AE1115E9Fc99dF0BC93d71d0'
abi: BaalSummonerV2
startBlock: 7428979
startBlock: 4816767
mapping:
kind: ethereum/events
apiVersion: 0.0.5
apiVersion: 0.0.6
language: wasm/assemblyscript
entities:
- Dao
Expand All @@ -32,14 +32,14 @@ dataSources:
file: ./src/baal-summoner-mapping.ts
- kind: ethereum/contract
name: VaultSummoner
network: base
network: sepolia
source:
address: '0x2eF2fC8a18A914818169eFa183db480d31a90c5D'
address: '0x763f5c2E59f997A6cC48Bf1228aBf61325244702'
abi: VaultSummoner
startBlock: 7428979
startBlock: 4816767
mapping:
kind: ethereum/events
apiVersion: 0.0.5
apiVersion: 0.0.6
language: wasm/assemblyscript
entities:
- Dao
Expand All @@ -54,14 +54,14 @@ dataSources:
file: ./src/vault-summoner-mapping.ts
- kind: ethereum/contract
name: Poster
network: base
network: sepolia
source:
address: '0x000000000000cd17345801aa8147b8d3950260ff'
abi: Poster
startBlock: 7428979
startBlock: 4816767
mapping:
kind: ethereum/events
apiVersion: 0.0.5
apiVersion: 0.0.6
language: wasm/assemblyscript
entities:
- Post
Expand All @@ -75,14 +75,14 @@ dataSources:
file: ./src/poster-mapping.ts
- kind: ethereum/contract
name: TributeMinion
network: base
network: sepolia
source:
address: '0x00768B047f73D88b6e9c14bcA97221d6E179d468'
address: '0xdb4D89F2199b9Cf451B7Ff4bdC94b1c96De4bdD0'
abi: TributeMinion
startBlock: 7428979
startBlock: 4816767
mapping:
kind: ethereum/events
apiVersion: 0.0.5
apiVersion: 0.0.6
language: wasm/assemblyscript
entities:
- Proposal
Expand All @@ -100,12 +100,12 @@ dataSources:
templates:
- kind: ethereum/contract
name: BaalTemplate
network: base
network: sepolia
source:
abi: Baal
mapping:
kind: ethereum/events
apiVersion: 0.0.5
apiVersion: 0.0.6
language: wasm/assemblyscript
file: ./src/baal-mapping.ts
entities:
Expand Down Expand Up @@ -149,12 +149,12 @@ templates:
handler: handleLockManager
- kind: ethereum/contract
name: SharesTemplate
network: base
network: sepolia
source:
abi: Shares
mapping:
kind: ethereum/events
apiVersion: 0.0.5
apiVersion: 0.0.6
language: wasm/assemblyscript
file: ./src/token-mapping.ts
entities:
Expand All @@ -172,12 +172,12 @@ templates:
handler: handleSharesTransfer
- kind: ethereum/contract
name: LootTemplate
network: base
network: sepolia
source:
abi: Loot
mapping:
kind: ethereum/events
apiVersion: 0.0.5
apiVersion: 0.0.6
language: wasm/assemblyscript
file: ./src/token-mapping.ts
entities:
Expand Down
2 changes: 1 addition & 1 deletion libs/keychain-utils/src/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const ENDPOINTS: KeychainList = {
'0xa4b1':
'https://api.thegraph.com/subgraphs/name/hausdao/daohaus-v3-arbitrum',
'0xaa36a7':
'https://api.thegraph.com/subgraphs/name/hausdao/daohaus-v3-sepolia',
'https://api.thegraph.com/subgraphs/name/hausdao/daohaus-v3-sepolia-2',
'0x2105':
'https://api.studio.thegraph.com/query/36740/daohaus-v3-base/version/latest',
},
Expand Down
2 changes: 2 additions & 0 deletions libs/moloch-v3-fields/src/fields/EpochDatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import { createGlobalStyle } from 'styled-components';
* @example FIELD { EPOCH_DATE_FIELD: {id: "epochDate",type: "epochDateField",label: "Epoch Date Field",}},
*/

// TODO: set the default somehow and enforce required

export const EpochDatePicker = (props: Buildable<Field>) => {
const { setValue } = useFormContext();
const [startDate, setStartDate] = useState(new Date());
Expand Down
4 changes: 2 additions & 2 deletions libs/moloch-v3-fields/src/fields/MarkdownField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const MarkDownContainer = styled.div`
padding: 10px;
margin-bottom: 5rem;
border-radius: 5px;
background-color: hsl(228, 43.3%, 17.5%);
background-color: ${({ theme }) => theme.secondary.step11};
font-size: 1.5rem;
font-family: inherit;
`;
Expand All @@ -44,7 +44,7 @@ const DialogMarkDownContainer = styled.div`
padding: 10px;
margin-bottom: 5rem;
border-radius: 5px;
background-color: hsl(228, 43.3%, 17.5%);
background-color: ${({ theme }) => theme.secondary.step11};
font-size: 1.5rem;
font-family: inherit;
`;
Expand Down
12 changes: 12 additions & 0 deletions libs/moloch-v3-fields/src/utils/walletConnectV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,18 @@ const useWalletConnectV2 = (): useWalletConnectType => {
});
break;
}
case 'eth_estimateGas': {
// notice: we don't require to estimate gas for the individual contract call to build the proposal calldata
await web3wallet.respondSessionRequest({
topic,
response: {
id,
jsonrpc: '2.0',
result: '0x0', // notice: respond zero gas by default
},
});
break;
}
default: {
const errorMsg = 'Tx type not supported';
setError(errorMsg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export const MemberList = ({
hasNextPage,
orderMembers,
} = useDaoMembers();

const isMd = useBreakpoint(widthQuery.md);

const tableData = useMemo<MolochV3Members>(() => {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"cross-fetch": "^3.1.5",
"date-fns": "^2.29.3",
"deep-eql": "^4.1.1",
"dotenv": "^16.4.5",
"ethereum-blockies-base64": "^1.0.2",
"ethers": "^5.7.2",
"ethers-multisend": "^2.4.0",
Expand Down
Loading
Loading