This contract manages AI-related submissions, allowing users to submit data for processing, store results, and manage submissions.
touch me https://linktr.ee/pichtran
Represents a single AI submission.
id
: u64 - Unique identifier for the submissiondata
: vector - Raw data for the submissionresult_link
: Option - Optional link to the resultresult_data
: Option<vector> - Optional raw result datametadata
: Option<vector> - Optional metadata for the submission
Manages the state of the AI contract.
submissions
: SimpleMap<u64, Submission> - Map of all submissionssubmission_counter
: u64 - Counter for generating unique submission IDssubmission_events
: EventHandle - Handle for submission events
Event emitted when a new submission is created.
id
: u64 - ID of the submissiondata
: vector - Raw data of the submission
Initializes the AI contract state.
Creates a new submission.
Parameters:
account
: The signer creating the submissiondata
: Raw data for the submissionpayment
: Payment in AptosCoin (minimum 0.01 APT)
Emits a SubmissionEvent
.
Stores the result for a given submission.
Parameters:
account
: The signer storing the resultid
: ID of the submissionlink
: Address link to the resultresult_data
: Raw result datametadata
: Metadata for the result
Deletes a submission.
Parameters:
account
: The signer deleting the submissionid
: ID of the submission to delete
Retrieves a submission by its ID.
Retrieves all submissions.
E_INSUFFICIENT_PAYMENT
: u64 = 1 - Insufficient payment for submissionE_SUBMISSION_NOT_FOUND
: u64 = 2 - Submission not found
Emitted when a new submission is created.
Fields:
id
: u64 - ID of the new submissiondata
: vector - Raw data of the submission
- The contract uses AptosCoin for payments.
- Submissions require a minimum payment of 0.01 APT.
- The contract maintains a global state for all submissions.
- Results can be stored for each submission after processing.
- Submissions can be deleted, but there's no built-in refund mechanism.