Skip to content

Commit

Permalink
reduce deposit for set call (#162)
Browse files Browse the repository at this point in the history
  • Loading branch information
Megha-Dev-19 authored Feb 16, 2024
1 parent 2360588 commit ce33fc6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 25 deletions.
4 changes: 1 addition & 3 deletions apps/builddao/widget/Proposals.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,7 @@ const handleVote = ({ action, proposalId, proposer, showNotification }) => {
data: notification,
options: { refund_unused_deposit: true }
},
deposit: Big(JSON.stringify(notification).length * 16)
.mul(Big(10).pow(20))
.toString()
deposit: 100000000000000000000000
}
]
: null
Expand Down
42 changes: 20 additions & 22 deletions apps/builddao/widget/components/buttons/Connect.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { joinBtnChildren, connectedChildren, showActivity, className, href } =
props;

const { Bullet } = VM.require("buildhub.near/widget/components") || {
Bullet: () => <></>,
Bullet: () => <></>
};
const DaoSDK = VM.require("sdks.near/widget/SDKs.Sputnik.DaoSDK") || (() => {});

Expand All @@ -18,14 +18,14 @@ const userAccountId = context.accountId;

const data = sdk?.checkIsMemberOrPending({
accountId: userAccountId,
rolesToCheck: ["community", "council"],
rolesToCheck: ["community", "council"]
});

const connectEdge = Social.keys(
`${userAccountId}/graph/connect/${daoId}`,
undefined,
{
values_only: true,
values_only: true
}
);

Expand All @@ -44,29 +44,27 @@ const handleJoin = () => {
[userAccountId]: {
graph: {
connect: {
[daoId]: "",
},
[daoId]: ""
}
},
index: {
graph: JSON.stringify({
key: "connect",
value: {
type: "connect",
accountId: daoId,
},
}),
accountId: daoId
}
})
},
notify: JSON.stringify({
key: daoId,
value: {
type: "connect",
},
}),
},
type: "connect"
}
})
}
};
const socialDeposit = Big(JSON.stringify(connectData).length * 16).mul(
Big(10).pow(20)
);

sdk.createAddMemberProposal({
description: `add ${userAccountId} to the ${roleId} group`,
memberId: userAccountId,
Expand All @@ -77,10 +75,10 @@ const handleJoin = () => {
{
contractName: "social.near",
methodName: "set",
deposit: socialDeposit.toFixed(),
args: { data: connectData, options: { refund_unused_deposit: true } },
},
],
deposit: 100000000000000000000000,
args: { data: connectData, options: { refund_unused_deposit: true } }
}
]
});
};

Expand Down Expand Up @@ -120,7 +118,7 @@ const Container = styled.div`
`;

const { href: linkHref } = VM.require("buildhub.near/widget/lib.url") || {
href: () => {},
href: () => {}
};

const Component = () => {
Expand All @@ -144,8 +142,8 @@ const Component = () => {
to={linkHref({
widgetSrc: "buildhub.near/widget/app",
params: {
page: "feed",
},
page: "feed"
}
})}
>
View Activity{" "}
Expand Down

0 comments on commit ce33fc6

Please sign in to comment.