Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
natebuch committed Jan 23, 2024
1 parent a6a9ed3 commit cfa26e9
Show file tree
Hide file tree
Showing 32 changed files with 1,175 additions and 353 deletions.
29 changes: 11 additions & 18 deletions Clarinet.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ telemetry = true
cache_dir = './.cache'
requirements = []
[contracts.bootstrap]
path = 'contracts/bootstrap.clar'
path = 'contracts/proposals/bootstrap.clar'
clarity_version = 2
epoch = 2.4

[contracts.community-vault]
path = 'contracts/community-vault.clar'
[contracts.grants-vault]
path = 'contracts/extensions/grants-vault.clar'
clarity_version = 2
epoch = 2.4

Expand All @@ -21,52 +21,45 @@ clarity_version = 2
epoch = 2.4

[contracts.extension-trait]
path = 'contracts/extension-trait.clar'
path = 'contracts/traits/extension-trait.clar'
clarity_version = 2
epoch = 2.4

[contracts.membership-token]
path = 'contracts/membership-token.clar'
path = 'contracts/extensions/membership-token.clar'
clarity_version = 2
epoch = 2.4

[contracts.milestone-disbursement]
path = 'contracts/milestone-disbursement.clar'
path = 'contracts/extensions/milestone-disbursement.clar'
clarity_version = 2
epoch = 2.4

[contracts.proposal-submission]
path = 'contracts/proposal-submission.clar'
path = 'contracts/extensions/proposal-submission.clar'
clarity_version = 2
epoch = 2.4

[contracts.proposal-trait]
path = 'contracts/proposal-trait.clar'
path = 'contracts/traits/proposal-trait.clar'
clarity_version = 2
epoch = 2.4

[contracts.proposal-voting]
path = 'contracts/proposal-voting.clar'
path = 'contracts/extensions/proposal-voting.clar'
clarity_version = 2
epoch = 2.4

[contracts.test-grant]
path = 'contracts/test-grant.clar'
path = 'contracts/test_proposals/test-grant.clar'
clarity_version = 2
epoch = 2.4

[contracts.vault]
path = 'contracts/vault.clar'
path = 'contracts/extensions/vault.clar'
clarity_version = 2
epoch = 2.4

[contracts.community-vault-proposal]
path = 'contracts/community-vault-proposal.clar'
clarity_version = 2
epoch = 2.4
[repl.analysis]
passes = []

[repl.analysis.check_checker]
strict = false
trusted_sender = false
Expand Down
249 changes: 249 additions & 0 deletions api/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,249 @@
const express = require('express')

Check failure on line 1 in api/index.js

View workflow job for this annotation

GitHub Actions / Lint

Require statement not part of import statement

Check failure on line 1 in api/index.js

View workflow job for this annotation

GitHub Actions / Lint

Insert `;`
const app = express()

Check failure on line 2 in api/index.js

View workflow job for this annotation

GitHub Actions / Lint

Insert `;`

const port = 3000

Check failure on line 4 in api/index.js

View workflow job for this annotation

GitHub Actions / Lint

Insert `;`
app.use(express.json());

app.get('/', (req, res) => {
res.send('Hello, Express.js!');
});

app.listen(port, () => {
console.log(`Listening on port ${port}`)

Check failure on line 12 in api/index.js

View workflow job for this annotation

GitHub Actions / Lint

Insert `;`
})

Check failure on line 13 in api/index.js

View workflow job for this annotation

GitHub Actions / Lint

Insert `;`

app.post("/api/bootstrap", async (req, res) => {

Check failure on line 15 in api/index.js

View workflow job for this annotation

GitHub Actions / Lint

Replace `"/api/bootstrap"` with `'/api/bootstrap'`
const events = req.body;

Check failure on line 16 in api/index.js

View workflow job for this annotation

GitHub Actions / Lint

Delete `··`
console.log(events)

Check failure on line 17 in api/index.js

View workflow job for this annotation

GitHub Actions / Lint

Replace `··console.log(events)` with `console.log(events);`
console.log(' ')

Check failure on line 18 in api/index.js

View workflow job for this annotation

GitHub Actions / Lint

Replace `····console.log('·······················')` with `··console.log('·······················');`
console.log('**********************************************************************************************************')
console.log(' ')
//Loop through each item in the apply array
events.apply.forEach((item) => {
// Loop through each transaction in the item
console.log(item)
item.transactions.forEach((transaction) => {
// If the transaction has operations, loop through them
if (transaction.operations?.length) {
transaction.operations.forEach((operation) => {
// Log the operation
console.log({ operation });
console.log(' ')
console.log('**********************************************************************************************************')
console.log(' ')
console.log(
{events: transaction.metadata.receipt.events[0].data},
{metadata: transaction.metadata},
{transaction: transaction}
)
console.log(' ')
console.log('**********************************************************************************************************')
console.log(' ')
});
} else {
console.log(
{events: transaction.metadata.receipt.events[0].data},
{metadata: transaction.metadata},
{transaction: transaction}
)
console.log(' ')
console.log('**********************************************************************************************************')
console.log(' ')
}
});
console.log('/////////////////////////////////////END/////////////////////////////////////')
});

// Send a response back to Chainhook to acknowledge receipt of the event
res.status(200).send({ message: "Bootstrap added!" });
});

app.post("/api/proposal-submission", async (req, res) => {
const events = req.body;
console.log(events)
console.log(' ')
console.log('**********************************************************************************************************')
console.log(' ')
//Loop through each item in the apply array
events.apply.forEach((item) => {
// Loop through each transaction in the item
item.transactions.forEach((transaction) => {
// If the transaction has operations, loop through them
if (transaction.operations?.length) {
transaction.operations.forEach((operation) => {
// Log the operation
console.log({ operation });
console.log(' ')
console.log('**********************************************************************************************************')
console.log(' ')
});
} else {
console.log(
{events: transaction.metadata.receipt.events[0].data},
{metadata: transaction.metadata},
{transaction: transaction}
)
console.log(' ')
console.log('**********************************************************************************************************')
console.log(' ')
}
});
console.log('///////////////////////////////////////// END \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')
});


// Send a response back to Chainhook to acknowledge receipt of the event
res.status(200).send({ message: "Proposal added!" });
});

app.post("/api/vote", async (req, res) => {
const events = req.body;
console.log(events)
console.log(' ')
console.log('**********************************************************************************************************')
console.log(' ')
//Loop through each item in the apply array
events.apply.forEach((item) => {
// Loop through each transaction in the item
item.transactions.forEach((transaction) => {
// If the transaction has operations, loop through them
if (transaction.operations?.length) {
transaction.operations.forEach((operation) => {
// Log the operation
console.log({ operation });
console.log(' ')
console.log('**********************************************************************************************************')
console.log(' ')
});
} else {
console.log(
{events: transaction.metadata.receipt.events[0].data},
{metadata: transaction.metadata},
{transaction: transaction}
)
console.log(' ')
console.log('**********************************************************************************************************')
console.log(' ')
}
});
console.log('///////////////////////////////////////// END \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')
});


// Send a response back to Chainhook to acknowledge receipt of the event
res.status(200).send({ message: "Vote added!" });
});

app.post("/api/bootstrap", async (req, res) => {
const events = req.body;
console.log(events)
console.log(' ')
console.log('**********************************************************************************************************')
console.log(' ')
//Loop through each item in the apply array
events.apply.forEach((item) => {
// Loop through each transaction in the item
item.transactions.forEach((transaction) => {
// If the transaction has operations, loop through them
if (transaction.operations?.length) {
transaction.operations.forEach((operation) => {
// Log the operation
console.log({ operation });
console.log(' ')
console.log('**********************************************************************************************************')
console.log(' ')
});
} else {
console.log(
{events: transaction.metadata.receipt.events[0].data},
{metadata: transaction.metadata},
{transaction: transaction}
)
console.log(' ')
console.log('**********************************************************************************************************')
console.log(' ')
}
});
console.log('///////////////////////////////////////// END \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')
});


// Send a response back to Chainhook to acknowledge receipt of the event
res.status(200).send({ message: "Vote added!" });
});

app.post("/api/test", async (req, res) => {
const events = req.body;
console.log(events)
console.log(' ')
console.log('**********************************************************************************************************')
console.log(' ')
//Loop through each item in the apply array
events.apply.forEach((item) => {
// Loop through each transaction in the item
item.transactions.forEach((transaction) => {
// If the transaction has operations, loop through them
if (transaction.operations?.length) {
transaction.operations.forEach((operation) => {
// Log the operation
console.log({ operation });
console.log(' ')
console.log('**********************************************************************************************************')
console.log(' ')
});
} else {
console.log(
{events: transaction.metadata.receipt.events[0].data},
{metadata: transaction.metadata},
{transaction: transaction}
)
console.log(' ')
console.log('**********************************************************************************************************')
console.log(' ')
}
});
console.log('///////////////////////////////////////// END \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')
});

// Send a response back to Chainhook to acknowledge receipt of the event
res.status(200).send({ message: "Test Success!" });
});

app.post("/api/conclude-proposal", async (req, res) => {
const events = req.body;
console.log(events)
console.log(' ')
console.log('**********************************************************************************************************')
console.log(' ')
//Loop through each item in the apply array
events.apply.forEach((item) => {
// Loop through each transaction in the item
console.log(item)
// item.transactions.forEach((transaction) => {
// // If the transaction has operations, loop through them
// if (transaction.operations?.length) {
// transaction.operations.forEach((operation) => {
// // Log the operation
// console.log({ operation });
// console.log(' ')
// console.log('**********************************************************************************************************')
// console.log(' ')
// });
// } else {
// console.log(
// {events: transaction.metadata.receipt.events[0].data},
// {metadata: transaction.metadata},
// {transaction: transaction}
// )
// console.log(' ')
// console.log('**********************************************************************************************************')
// console.log(' ')
// }
// });
console.log('///////////////////////////////////////// END \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')
});


// Send a response back to Chainhook to acknowledge receipt of the event
res.status(200).send({ message: "Conclusion Success!" });
});
Loading

0 comments on commit cfa26e9

Please sign in to comment.