Skip to content
Draft
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
284 changes: 284 additions & 0 deletions packages/website/src/constants/contracts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,284 @@
import { Address } from 'viem';

// Contract addresses for different networks
export const CONTRACT_ADDRESSES = {
// Mainnet
1: {
CANNON_REGISTRY: '0x8E5C7EFC9636A6A0408A46BB7F617094B81e5dba' as Address,
CANNON_SUBSCRIPTION: '0x0000000000000000000000000000000000000000' as Address, // TODO: Add actual address
USDC: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' as Address,
},
// Optimism
10: {
CANNON_REGISTRY: '0x8E5C7EFC9636A6A0408A46BB7F617094B81e5dba' as Address,
CANNON_SUBSCRIPTION: '0x337D68596cEc15647f2710C9EdE2F48aB7f30657' as Address, // TODO: Add actual address
USDC: '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85' as Address,
},
// Sepolia
11155111: {
CANNON_REGISTRY: '0x0000000000000000000000000000000000000000' as Address, // TODO: Add actual address
CANNON_SUBSCRIPTION: '0x0000000000000000000000000000000000000000' as Address, // TODO: Add actual address
USDC: '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238' as Address,
},
} as const;

// CannonSubscription ABI
export const CANNON_SUBSCRIPTION_ABI = [
{
inputs: [
{
internalType: 'uint16',
name: '_planId',
type: 'uint16',
},
],
name: 'getPlan',
outputs: [
{
components: [
{
internalType: 'uint256',
name: 'price',
type: 'uint256',
},
{
internalType: 'uint16',
name: 'id',
type: 'uint16',
},
{
internalType: 'uint32',
name: 'duration',
type: 'uint32',
},
{
internalType: 'uint32',
name: 'quota',
type: 'uint32',
},
{
internalType: 'uint16',
name: 'minTerms',
type: 'uint16',
},
{
internalType: 'uint16',
name: 'maxTerms',
type: 'uint16',
},
{
internalType: 'bool',
name: 'active',
type: 'bool',
},
{
internalType: 'bool',
name: 'refundable',
type: 'bool',
},
],
internalType: 'struct Subscription.Plan',
name: '',
type: 'tuple',
},
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{
internalType: 'address',
name: '_user',
type: 'address',
},
],
name: 'getAvailablePlans',
outputs: [
{
internalType: 'uint16[]',
name: '',
type: 'uint16[]',
},
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{
internalType: 'address',
name: '_user',
type: 'address',
},
],
name: 'getMembership',
outputs: [
{
components: [
{
internalType: 'uint16',
name: 'planId',
type: 'uint16',
},
{
internalType: 'uint32',
name: 'activeFrom',
type: 'uint32',
},
{
internalType: 'uint32',
name: 'activeUntil',
type: 'uint32',
},
{
internalType: 'uint32',
name: 'availableCredits',
type: 'uint32',
},
],
internalType: 'struct Subscription.Membership',
name: '',
type: 'tuple',
},
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{
internalType: 'address',
name: '_user',
type: 'address',
},
],
name: 'hasActiveMembership',
outputs: [
{
internalType: 'bool',
name: '',
type: 'bool',
},
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{
internalType: 'uint16',
name: '_planId',
type: 'uint16',
},
{
internalType: 'uint32',
name: '_amountOfTerms',
type: 'uint32',
},
],
name: 'purchaseMembership',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [],
name: 'cancelMembership',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [],
name: 'TOKEN',
outputs: [
{
internalType: 'contract IERC20',
name: '',
type: 'address',
},
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'VAULT',
outputs: [
{
internalType: 'address',
name: '',
type: 'address',
},
],
stateMutability: 'view',
type: 'function',
},
] as const;

// ERC20 ABI for token interactions
export const ERC20_ABI = [
{
inputs: [
{
internalType: 'address',
name: 'owner',
type: 'address',
},
],
name: 'balanceOf',
outputs: [
{
internalType: 'uint256',
name: '',
type: 'uint256',
},
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{
internalType: 'address',
name: 'spender',
type: 'address',
},
],
name: 'allowance',
outputs: [
{
internalType: 'uint256',
name: '',
type: 'uint256',
},
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{
internalType: 'address',
name: 'spender',
type: 'address',
},
{
internalType: 'uint256',
name: 'amount',
type: 'uint256',
},
],
name: 'approve',
outputs: [
{
internalType: 'bool',
name: '',
type: 'bool',
},
],
stateMutability: 'nonpayable',
type: 'function',
},
] as const;
1 change: 1 addition & 0 deletions packages/website/src/constants/links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ export const links = {
IPFS_UPLOAD: '/ipfs/upload',
DOCS_CLI_RUN: '/learn/cli#run',
DOCS_CANNONFILE_PROVISION: '/learn/cannonfile#clone',
PRICING: '/pricing',
};
3 changes: 3 additions & 0 deletions packages/website/src/features/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ const NavLinks = () => {
<NavLink href={links.LEARN} isActive={pathname.startsWith('/learn')}>
Docs
</NavLink>
<NavLink href={links.PRICING} isActive={pathname.startsWith('/pricing')}>
Pricing
</NavLink>
</div>
);
};
Expand Down
Loading
Loading