📝 Description:
Create a basic Cairo 1.0 smart contract on StarkNet that supports the creation of a "payment intent". This contract will allow users to register a payment by specifying an amount, currency, and recipient. For now, this is a simple mockup – it won’t actually transfer funds, but will store intent data on-chain.
This is a foundational piece for integrating payments with smart contracts in a future release.
✅ Requirements:
🧪 Testing Requirements (Cairo Unit Tests):
🧱 Contract Storage:
@storage_var payment_intents(intent_id: felt252) -> PaymentIntentData
@storage_var intent_counter() -> u128 (for generating unique IDs)
⚙️ Dependencies:
- Use Cairo 1.0 syntax
- Use
starknet::ContractAddress for addresses
📝 Description:
Create a basic Cairo 1.0 smart contract on StarkNet that supports the creation of a "payment intent". This contract will allow users to register a payment by specifying an amount, currency, and recipient. For now, this is a simple mockup – it won’t actually transfer funds, but will store intent data on-chain.
This is a foundational piece for integrating payments with smart contracts in a future release.
✅ Requirements:
Define a Cairo contract called
PaymentIntent.Define a struct
PaymentIntentData:amount: u256currency: felt252(ISO code or symbol as felt252)customer: ContractAddressrecipient: ContractAddressstatus: felt252(initially"created"as felt)Implement a function
create_intent:amount,currency,customer,recipientPaymentIntentDatain a mappingImplement a getter function
get_intent(intent_id: felt252)to return stored data.🧪 Testing Requirements (Cairo Unit Tests):
🧱 Contract Storage:
@storage_var payment_intents(intent_id: felt252) -> PaymentIntentData@storage_var intent_counter() -> u128(for generating unique IDs)⚙️ Dependencies:
starknet::ContractAddressfor addresses