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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Loreum Chamber

Loreum is a secure shared vault for communities. NFT holders elect a board of leaders who work together to manage funds and approve transactions through a unique delegation mechanism.
Loreum is enterprise treasury infrastructure for organizations. Chambers function as corporate entities with an elected board of directors who oversee fiduciary operations and approve transactions through multi-signature governance.

## Overview

Expand Down
42 changes: 34 additions & 8 deletions app/src/components/DelegationManager.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useState, useMemo } from 'react'
import { motion } from 'framer-motion'
import { useAccount } from 'wagmi'
import { formatUnits, parseUnits } from 'viem'
import {
FiSend,
Expand All @@ -17,6 +18,7 @@ import {
useChamberEventRefresh,
useSimulateDelegate,
useSimulateUndelegate,
useUserNFTs,
} from '@/hooks'
import type { BoardMember } from '@/types'

Expand All @@ -26,6 +28,7 @@ interface DelegationManagerProps {
delegations: { tokenId: bigint; amount: bigint }[]
members: BoardMember[]
vaultSymbol?: string
nftToken?: `0x${string}`
}

export default function DelegationManager({
Expand All @@ -34,7 +37,10 @@ export default function DelegationManager({
delegations,
members,
vaultSymbol,
nftToken,
}: DelegationManagerProps) {
const { address: userAddress } = useAccount()
const { tokenIds: userNFTTokenIds } = useUserNFTs(nftToken, userAddress)
const [delegateTokenId, setDelegateTokenId] = useState('')
const [delegateAmount, setDelegateAmount] = useState('')
const [undelegateTokenId, setUndelegateTokenId] = useState('')
Expand Down Expand Up @@ -229,14 +235,34 @@ export default function DelegationManager({
<label className="block text-slate-300 text-sm font-medium mb-2">
NFT Token ID
</label>
<input
type="number"
placeholder="Enter token ID"
className="input"
value={delegateTokenId}
onChange={(e) => setDelegateTokenId(e.target.value)}
min="1"
/>
{userNFTTokenIds.length > 0 ? (
<select
className="input"
value={delegateTokenId}
onChange={(e) => setDelegateTokenId(e.target.value)}
>
<option value="">Select your NFT...</option>
{userNFTTokenIds.map((id) => (
<option key={id.toString()} value={id.toString()}>
#{id.toString()} {members.find(m => m.tokenId === id) ? `(Rank #${members.find(m => m.tokenId === id)?.rank})` : ''}
</option>
))}
</select>
) : (
<input
type="number"
placeholder="Enter token ID"
className="input"
value={delegateTokenId}
onChange={(e) => setDelegateTokenId(e.target.value)}
min="1"
/>
)}
{userNFTTokenIds.length > 0 && (
<p className="text-slate-500 text-xs mt-1">
Select an NFT you own to delegate voting power to it
</p>
)}
</div>

<div>
Expand Down
3 changes: 2 additions & 1 deletion app/src/components/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Outlet, Link, useLocation } from 'react-router-dom'
import { ConnectButton } from '@rainbow-me/rainbowkit'
import { motion } from 'framer-motion'
import { FiHome, FiGithub, FiBook, FiCpu } from 'react-icons/fi'
import { FiHome, FiGithub, FiBook, FiCpu, FiPlus } from 'react-icons/fi'

const navItems = [
{ path: '/', label: 'Chambers', icon: FiHome },
{ path: '/deploy', label: 'Deploy Chamber', icon: FiPlus },
{ path: '/deploy-agent', label: 'Deploy Agent', icon: FiCpu },
{ path: '/docs', label: 'Docs', icon: FiBook },
]
Expand Down
47 changes: 47 additions & 0 deletions app/src/contracts/abis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,16 @@ export const chamberAbi = [
outputs: [],
stateMutability: 'nonpayable',
},
{
type: 'function',
name: 'cancelTransaction',
inputs: [
{ name: 'tokenId', type: 'uint256' },
{ name: 'transactionId', type: 'uint256' },
],
outputs: [],
stateMutability: 'nonpayable',
},
{
type: 'function',
name: 'submitBatchTransactions',
Expand Down Expand Up @@ -343,6 +353,30 @@ export const chamberAbi = [
outputs: [{ name: '', type: 'bool' }],
stateMutability: 'view',
},
{
type: 'function',
name: 'getCancelled',
inputs: [{ name: 'nonce', type: 'uint256' }],
outputs: [{ name: '', type: 'bool' }],
stateMutability: 'view',
},
{
type: 'function',
name: 'getCancelConfirmation',
inputs: [
{ name: 'tokenId', type: 'uint256' },
{ name: 'nonce', type: 'uint256' },
],
outputs: [{ name: '', type: 'bool' }],
stateMutability: 'view',
},
{
type: 'function',
name: 'getCancelConfirmations',
inputs: [{ name: 'nonce', type: 'uint256' }],
outputs: [{ name: '', type: 'uint8' }],
stateMutability: 'view',
},
{
type: 'function',
name: 'getNextTransactionId',
Expand Down Expand Up @@ -385,6 +419,19 @@ export const chamberAbi = [
{ name: 'executor', type: 'address', indexed: true },
],
},
{
type: 'event',
name: 'CancelTransaction',
inputs: [
{ name: 'tokenId', type: 'uint256', indexed: true },
{ name: 'nonce', type: 'uint256', indexed: true },
],
},
{
type: 'event',
name: 'TransactionCancelled',
inputs: [{ name: 'nonce', type: 'uint256', indexed: true }],
},
{
type: 'event',
name: 'Received',
Expand Down
12 changes: 6 additions & 6 deletions app/src/contracts/deployments.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"agentImplementation": "0x4A679253410272dd5232B3Ff7cF5dbB88f295319",
"agentImplementation": "0x4826533B4897376654Bb4d4AD88B7faFD0C98528",
"chainId": 31337,
"chamberImplementation": "0xa85233C63b9Ee964Add6F2cffe00Fd84eb32338f",
"mockERC20": "0x67d269191c92Caf3cD7723F116c85e6E9bf55933",
"mockERC721": "0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E",
"registry": "0xc5a5C42992dECbae36851359345FE25997F5C42d",
"timestamp": 1772158875
"chamberImplementation": "0x70e0bA845a1A0F2DA3359C97E0285013525FFC49",
"mockERC20": "0x9d4454B023096f34B160D6B654540c56A1F81688",
"mockERC721": "0x5eb3Bc0a489C5A8288765d2336659EbCA68FCd00",
"registry": "0x8f86403A4DE0BB5791fa46B8e795C547942fE4Cf",
"timestamp": 1773521038
}
Loading
Loading