Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions contracts/sprintfund-core-v3.clar
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@
(ok (var-get contract-owner))
)

;; Get the contract version
;; @returns: Contract version number
(define-read-only (get-version)
(ok u3)
)

;; ============================================
;; Initialization
;; ============================================
Expand Down
4 changes: 4 additions & 0 deletions frontend/components/CreateProposalForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import CategoryTags from './common/CategoryTags';
import { predictProposalSuccess } from '@/utils/successPredictor';
import { Target, AlertCircle, Sparkles, Brain, CheckCircle2 } from 'lucide-react';
import { useTransaction } from '@/hooks/useTransaction';
import { ContractVersionGuard } from './common/ContractVersionGuard';

const NETWORK = STACKS_MAINNET;

Expand Down Expand Up @@ -150,6 +151,8 @@ export default function CreateProposalForm({ userAddress }: CreateProposalFormPr
</div>
</div>

<ContractVersionGuard>

<form onSubmit={handleSubmit} className="space-y-4 sm:space-y-6">
{/* Title Field */}
<div>
Expand Down Expand Up @@ -296,6 +299,7 @@ export default function CreateProposalForm({ userAddress }: CreateProposalFormPr
)}
</button>
</form>
</ContractVersionGuard>
</motion.div>

{/* Success Forecast Sidebar */}
Expand Down
89 changes: 46 additions & 43 deletions frontend/components/ExecuteProposal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { STACKS_MAINNET } from '@stacks/network';
import { CONTRACT_ADDRESS, CONTRACT_NAME } from '@/config';
import { useTransaction } from '@/hooks/useTransaction';
import { useCurrentBlockHeight } from '@/hooks';
import { ContractVersionGuard } from './common/ContractVersionGuard';

const NETWORK = STACKS_MAINNET;

Expand Down Expand Up @@ -111,53 +112,55 @@ export default function ExecuteProposal({

return (
<div className="mt-4 pt-4 border-t border-white/10">
<div className="bg-green-500/10 border border-green-400/30 rounded-lg p-4">
<div className="flex items-start space-x-2 mb-3">
<svg className="w-5 h-5 text-green-300 mt-0.5 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<div className="flex-1">
<p className="text-green-200 text-sm font-medium">
This proposal has passed! You can now execute it.
</p>
<p className="text-green-300 text-xs mt-1">
Votes: {votesFor} for, {votesAgainst} against
</p>
<ContractVersionGuard>
<div className="bg-green-500/10 border border-green-400/30 rounded-lg p-4">
<div className="flex items-start space-x-2 mb-3">
<svg className="w-5 h-5 text-green-300 mt-0.5 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<div className="flex-1">
<p className="text-green-200 text-sm font-medium">
This proposal has passed! You can now execute it.
</p>
<p className="text-green-300 text-xs mt-1">
Votes: {votesFor} for, {votesAgainst} against
</p>
</div>
</div>
</div>

<button
onClick={handleExecute}
disabled={isExecuting}
className="w-full px-4 py-3 bg-gradient-to-r from-green-500 to-emerald-500 hover:from-green-600 hover:to-emerald-600 text-white rounded-lg font-semibold transition-all shadow-lg hover:shadow-xl disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center"
>
{isExecuting ? (
<>
<svg className="animate-spin h-5 w-5 text-white mr-2" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
<circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4"></circle>
<path className="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg>
<span>Executing Proposal...</span>
</>
) : (
'Execute Proposal'
<button
onClick={handleExecute}
disabled={isExecuting}
className="w-full px-4 py-3 bg-gradient-to-r from-green-500 to-emerald-500 hover:from-green-600 hover:to-emerald-600 text-white rounded-lg font-semibold transition-all shadow-lg hover:shadow-xl disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center"
>
{isExecuting ? (
<>
<svg className="animate-spin h-5 w-5 text-white mr-2" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
<circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4"></circle>
<path className="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg>
<span>Executing Proposal...</span>
</>
) : (
'Execute Proposal'
)}
</button>

{/* Success Message */}
{success && (
<div className="bg-green-500/20 border border-green-400/30 rounded-lg p-3 mt-3">
<p className="text-green-200 text-xs break-all">{success}</p>
</div>
)}
</button>

{/* Success Message */}
{success && (
<div className="bg-green-500/20 border border-green-400/30 rounded-lg p-3 mt-3">
<p className="text-green-200 text-xs break-all">{success}</p>
</div>
)}

{/* Error Message */}
{error && (
<div className="bg-red-500/20 border border-red-400/30 rounded-lg p-3 mt-3">
<p className="text-red-200 text-xs">{error}</p>
</div>
)}
</div>
{/* Error Message */}
{error && (
<div className="bg-red-500/20 border border-red-400/30 rounded-lg p-3 mt-3">
<p className="text-red-200 text-xs">{error}</p>
</div>
)}
</div>
</ContractVersionGuard>
</div>
);
}
Loading
Loading