Skip to content

Commit

Permalink
feat:script
Browse files Browse the repository at this point in the history
  • Loading branch information
Adegbite Ademola Kelvin authored and Adegbite Ademola Kelvin committed Jan 14, 2025
1 parent eaea8d6 commit 01b446e
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 7 deletions.
42 changes: 38 additions & 4 deletions scripts/src/contracts/community.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
import { Call } from "starknet-tokenbound-sdk";
import { coloniz_HUB_CONTRACT_ADDRESS, PROFILE_ADDRESS_ONE, PROFILE_ADDRESS_TWO } from "../helpers/constants";
import tokenbound from "../index";
import { cairo, CallData,CairoCustomEnum } from "starknet";

// "0x072426e3716e48a68accd60e3c67e666e08327a6f74cfe3a4accba5f9dddea3c"



export const GateKeepType = {
None: "None",
NFTGating: "NFTGating",
PermissionedGating:"PermissionedGating",
PaidGating: "PaidGating",
} as const;

const execute_create_community = async() =>{
let call:Call = {
to: "0x02408783725e0ad8badb2683f3ad243bd2cc5f431d970aaa532182501e3e6ae7", // "0x630c718a29c62798e2b96e9f16fc65f4b22855fa49a4bd9339bcc950af037f5", // "0xa21ac387d13c35370bd5539fd9f7cdcbcdec82a6a18e424a83611379facfa3", // coloniz_HUB_CONTRACT_ADDRESS,
to: coloniz_HUB_CONTRACT_ADDRESS,
selector:"0x8945c258076d05a649eb76dca07fe609b43b360775b41226e3a345e9593ab4",
calldata:[]
}
Expand Down Expand Up @@ -182,7 +191,6 @@ const execute_upvote = async () => {
}
};


const execute_downvote = async () => {
let call: Call = {
to: coloniz_HUB_CONTRACT_ADDRESS,
Expand All @@ -198,8 +206,34 @@ const execute_downvote = async () => {
}
};


// execute gatekeep
const execute_gatekeep = async() =>{
let comm_id = 3;
let gatekeep_type = new CairoCustomEnum({ [GateKeepType.PaidGating]: {} });
let permissioned_address = [1,"0x07da6cca38Afcf430ea53581F2eFD957bCeDfF798211309812181C555978DCC3"];
let erc20_address:string = "0x006e1698dcd0665757dd213a59aff489624bab8c970ce0482c23937a78879b04";
let amount = cairo.uint256(50);
let erc721_address = "0x0"
let paid_gating_details = cairo.tuple(erc20_address, amount)

let call: Call = {
to: coloniz_HUB_CONTRACT_ADDRESS,
selector:
"0x3494f4762774ed2020c6906a4da6be06137fc4a0a5ee07fbb404b10c1ae60e8",
calldata: CallData.compile([comm_id, gatekeep_type, erc721_address , permissioned_address, paid_gating_details]),
}
try {
const Resp = await tokenbound?.execute("0x075a4558a2e9d8b10fdb3d94d51b35312703cc7aae43a1ff95e234512e83783f", [call]);
console.log("execution-response=:", Resp);
} catch (error) {
console.log(error);
}
}

// execute_get_community();
execute_create_community();
// execute_create_community();
execute_gatekeep()
// execute_create_channel();
// execute_join_community();
// execute_make_post();
Expand Down
2 changes: 1 addition & 1 deletion scripts/src/helpers/constants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const HANDLE_CONTRACT_ADDRESS:string = "0x4cb40ffd9120ab0ff7632fe27710d5f979ad18e1294737ac5838ad7a437677a";
export const REGISTRY_HANDLE_CONTRACT_ADDRESS:string = "0x7d750ed304612f346b9ca5555e26fc80b279487b90d56e86a07668b9f1b6492";
export const coloniz_NFT_CONTRACT_ADDRESS:string = "0x4dca9ec1ed78ce5cddbbcec63d3620514ae66bc73a3942d48a011bad452ffe"
export const coloniz_HUB_CONTRACT_ADDRESS:string ="0x7e3c4c5275b93d985699b86486848b0bee8d75b88fbaf36fea339eeb74b8aa8"
export const coloniz_HUB_CONTRACT_ADDRESS:string ="0x04bd89ef797c5a34a3c8bcc9dafca270959d9edcd568ea22a2364ffb3af959f0"
export const FOLLOW_CONTRACT_ADDRESS:string = "0x60a56d724558a9cfbbf3a3fd4faebaa65678efe090d3dd49afa85d1bcc61eba"
export const PROFILE_ADDRESS_ONE:string = "0x206b999eeed11da16898664d6ad251563e6796a564c6eaddfae4d84350d4cf1";
export const PROFILE_ADDRESS_TWO:string = "0x75a4558a2e9d8b10fdb3d94d51b35312703cc7aae43a1ff95e234512e83783f"
8 changes: 6 additions & 2 deletions scripts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { TBAChainID, TBAVersion, TokenboundClient, WalletClient } from "starknet

const walletClient: WalletClient = {
address: "0x07EadF65B6D96A7DEbB36380fF936F6701a053Be8f2824D6293f188fA542C502",
privateKey: process.env.ACCOUNT_TWO_PRIVATE_KEY!,
privateKey: "",
};
const options = {
walletClient: walletClient,
Expand All @@ -11,4 +11,8 @@ const walletClient: WalletClient = {
jsonRPC: "https://starknet-sepolia.g.alchemy.com/starknet/version/rpc/v0_7/LSOcLfeCY8c4ovUNnDNX4YJhkMpsVD5F",
};
const tokenbound = new TokenboundClient(options);
export default tokenbound
export default tokenbound


// erc20 contract: 0x006e1698dcd0665757dd213a59aff489624bab8c970ce0482c23937a78879b04
// erc721: 0x04b91a940002d2d8d42272bc4de1dc5d7b34a8566c4fe655aa6ae8b8e0313b37

0 comments on commit 01b446e

Please sign in to comment.