Skip to content

Commit 7383848

Browse files
authored
Merge pull request #586 from dOrgTech/humanitez-fix
Fix for humanitez DAO
2 parents 215252a + a0c5fde commit 7383848

File tree

5 files changed

+152
-4
lines changed

5 files changed

+152
-4
lines changed

src/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { ActionSheetProvider } from "modules/explorer/context/ActionSheets"
2020
import { legacyTheme } from "theme/legacy"
2121
import { Footer } from "modules/common/Footer"
2222
import { FAQ } from "modules/home/FAQ"
23-
import { EnvKey, getEnv } from "services/config"
23+
import { EnvKey, HUMANITEZ_DAO, getEnv } from "services/config"
2424
import { DAOCreatorRouter } from "modules/creator/router"
2525
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider"
2626
import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs"
@@ -124,7 +124,7 @@ const App: React.FC = () => {
124124
<DAOExplorerRouter />
125125
</TZKTSubscriptionsProvider>
126126

127-
{window.location.href.indexOf("KT1PY9PXm8NMAgSEZg7bUtFjmV2Sj64bKuVV") !== -1 ? (
127+
{window.location.href.indexOf(HUMANITEZ_DAO) !== -1 ? (
128128
<>
129129
{/* Special case for this DAO which was created before FA1.2 fix was created for the smart contract */}
130130
<WarningFooter

src/services/config/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ export enum EnvKey {
2121
export enum FeatureFlag {
2222
lambdaDao = "lambdaDao"
2323
}
24+
25+
export const HUMANITEZ_DAO = "KT1PY9PXm8NMAgSEZg7bUtFjmV2Sj64bKuVV"

src/services/contracts/baseDAO/lambdaDAO/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ import { formatUnits } from "../../utils"
1313
import { LambdaAddArgs, LambdaExecuteArgs, LambdaRemoveArgs } from "./types"
1414

1515
import transfer_arg_type_michelson from "./michelson/supported_lambda_types/transfer_proposal_type.json"
16+
import transfer_proposal_type_before_fa12 from "./michelson/supported_lambda_types/transfer_proposal_type_before_fa1.2.json"
1617
import update_contract_delegate_type_michelson from "./michelson/supported_lambda_types/update_contract_delegate_proposal.json"
1718
import update_guardian_type_michelson from "./michelson/supported_lambda_types/update_guardian_proposal.json"
1819
import { Community } from "models/Community"
20+
import { HUMANITEZ_DAO } from "services/config"
1921

2022
const parser = new Parser()
2123

@@ -162,7 +164,10 @@ export class LambdaDAO extends BaseDAO {
162164
const contract = await getContract(tezos, this.data.address)
163165
const p = new Parser()
164166

165-
const transfer_arg_schema = new Schema(transfer_arg_type_michelson as MichelsonData)
167+
const transfer_michelson =
168+
this.data.address === HUMANITEZ_DAO ? transfer_proposal_type_before_fa12 : transfer_arg_type_michelson
169+
170+
const transfer_arg_schema = new Schema(transfer_michelson as MichelsonData)
166171
const transfer_proposal_args = {
167172
transfers: mapTransfersArgs(transfer_proposal.transfers, this.data.address),
168173
registry_diff: transfer_proposal.registry_diff.map(item => [char2Bytes(item.key), char2Bytes(item.value)]),
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
{
2+
"prim": "pair",
3+
"args": [
4+
{
5+
"prim": "pair",
6+
"args": [
7+
{
8+
"prim": "nat",
9+
"annots": [
10+
"%agora_post_id"
11+
]
12+
},
13+
{
14+
"prim": "list",
15+
"annots": [
16+
"%registry_diff"
17+
],
18+
"args": [
19+
{
20+
"prim": "pair",
21+
"args": [
22+
{
23+
"prim": "string"
24+
},
25+
{
26+
"prim": "option",
27+
"args": [
28+
{
29+
"prim": "string"
30+
}
31+
]
32+
}
33+
]
34+
}
35+
]
36+
}
37+
]
38+
},
39+
{
40+
"prim": "list",
41+
"annots": [
42+
"%transfers"
43+
],
44+
"args": [
45+
{
46+
"prim": "or",
47+
"args": [
48+
{
49+
"prim": "pair",
50+
"annots": [
51+
"%xtz_transfer_type"
52+
],
53+
"args": [
54+
{
55+
"prim": "mutez",
56+
"annots": [
57+
"%amount"
58+
]
59+
},
60+
{
61+
"prim": "address",
62+
"annots": [
63+
"%recipient"
64+
]
65+
}
66+
]
67+
},
68+
{
69+
"prim": "pair",
70+
"annots": [
71+
"%token_transfer_type"
72+
],
73+
"args": [
74+
{
75+
"prim": "address",
76+
"annots": [
77+
"%contract_address"
78+
]
79+
},
80+
{
81+
"prim": "list",
82+
"annots": [
83+
"%transfer_list"
84+
],
85+
"args": [
86+
{
87+
"prim": "pair",
88+
"args": [
89+
{
90+
"prim": "address",
91+
"annots": [
92+
"%from_"
93+
]
94+
},
95+
{
96+
"prim": "list",
97+
"annots": [
98+
"%txs"
99+
],
100+
"args": [
101+
{
102+
"prim": "pair",
103+
"args": [
104+
{
105+
"prim": "address",
106+
"annots": [
107+
"%to_"
108+
]
109+
},
110+
{
111+
"prim": "nat",
112+
"annots": [
113+
"%token_id"
114+
]
115+
},
116+
{
117+
"prim": "nat",
118+
"annots": [
119+
"%amount"
120+
]
121+
}
122+
]
123+
}
124+
]
125+
}
126+
]
127+
}
128+
]
129+
}
130+
]
131+
}
132+
]
133+
}
134+
]
135+
}
136+
]
137+
}

src/services/services/dao/mappers/proposal/types.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ import { bytes2Char } from "@taquito/tzip16"
1010
import { BaseDAO } from "services/contracts/baseDAO"
1111
import { DAOTemplate } from "modules/creator/state"
1212
import transfer_arg_type_michelson from "../../../../contracts/baseDAO/lambdaDAO/michelson/supported_lambda_types/transfer_proposal_type.json"
13+
import transfer_proposal_type_before_fa12 from "../../../../contracts/baseDAO/lambdaDAO/michelson/supported_lambda_types/transfer_proposal_type_before_fa1.2.json"
1314
import update_contract_delegate_type_michelson from "../../../../contracts/baseDAO/lambdaDAO/michelson/supported_lambda_types/update_contract_delegate_proposal.json"
1415
import update_guardian_type_michelson from "../../../../contracts/baseDAO/lambdaDAO/michelson/supported_lambda_types/update_guardian_proposal.json"
1516
import configuration_proposal_type_michelson from "../../../../contracts/baseDAO/lambdaDAO/michelson/supported_lambda_types/configuration_proposal_type.json"
1617
import { PMLambdaProposal } from "services/contracts/baseDAO/lambdaDAO/types"
18+
import { HUMANITEZ_DAO } from "services/config"
1719

1820
export enum IndexerStatus {
1921
CREATED = "created",
@@ -324,7 +326,9 @@ export class LambdaProposal extends Proposal {
324326
)
325327

326328
if (lambdaMetadata.lambdaHandler.handler_name === "transfer_proposal") {
327-
const transfer_arg_schema = new Schema(transfer_arg_type_michelson as MichelsonData)
329+
const transfer_michelson =
330+
this.dao.data.address === HUMANITEZ_DAO ? transfer_proposal_type_before_fa12 : transfer_arg_type_michelson
331+
const transfer_arg_schema = new Schema(transfer_michelson as MichelsonData)
328332
const transfer_proposal_data = transfer_arg_schema.Execute(lambdaMetadata.lambdaHandler.unpacked_argument)
329333

330334
const { agora_post_id, registry_diff, transfers } = transfer_proposal_data

0 commit comments

Comments
 (0)