*** Functions for Admins ***
Initialize the contract with two admins
fn __constructor(
env: soroban_sdk::Env,
admin1: soroban_sdk::Address,
admin2: soroban_sdk::Address,
)
Update one or both admins of the contract {Only admins can update}
fn update_admins(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
new_admin1: Option,
new_admin2: Option,
)
Create a new competition {Only admins can create}
fn create_competition(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
id: soroban_sdk::String,
id_description: soroban_sdk::String,
artist_add_start: u64,
artist_add_end: u64,
vote_start: u64,
vote_end: u64,
token: soroban_sdk::Address,
min_vote_tokens: u64,
)
Delete a competition and emergency withdraw funds {Only admin can delete}
fn delete_competition(
env: soroban_sdk::Env,
id: soroban_sdk::String,
from: soroban_sdk::Address,
)
Remove an artist from a competition {Only admin can remove}
fn remove_artist(
env: soroban_sdk::Env,
id: soroban_sdk::String,
from: soroban_sdk::Address,
artist_name: soroban_sdk::String,
)
Remove a registered artist from the global artist registry {Only admin can remove}
fn remove_registered_artist(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
artist_address: soroban_sdk::Address,
)
{User Write Fn for Art Competition}
Vote for an artist in a competition (one vote per wallet)
fn vote(
env: soroban_sdk::Env,
id: soroban_sdk::String,
from: soroban_sdk::Address,
artist: soroban_sdk::String,
)
Fund the competition pot
fn fund_pot(
env: soroban_sdk::Env,
id: soroban_sdk::String,
from: soroban_sdk::Address,
amount: u64,
)
Pays the competition winners
fn pay_winners(env: soroban_sdk::Env, id: soroban_sdk::String)
{Artist Write Fn for Art Competition}
Submit an artist to the competition
fn submit_art(
env: soroban_sdk::Env,
id: soroban_sdk::String,
artist_address: soroban_sdk::Address,
artist_name: soroban_sdk::String,
artwork_name: soroban_sdk::String,
description: soroban_sdk::String,
img_url: soroban_sdk::String,
)
Update artist metadata with optional parameters
fn update_submission_metadata(
env: soroban_sdk::Env,
id: soroban_sdk::String,
artist_name: soroban_sdk::String,
from: soroban_sdk::Address,
artwork_name: Option,
description: Option,
)
{Artist Write Fn for Artist Registration}
Add artist profile info (one per address, unique name)
fn add_artist_info(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
name: soroban_sdk::String,
bio: soroban_sdk::String,
img_url: soroban_sdk::String,
website: soroban_sdk::String,
mediums: soroban_sdk::Vec,
blockchains: soroban_sdk::Vec,
)
Update artist profile info (only by the artist, optional fields)
fn update_artist_info(
env: soroban_sdk::Env,
from: soroban_sdk::Address,
name: Option,
bio: Option,
img_url: Option,
website: Option,
mediums: Option>,
blockchains: Option>,
)
{Read Functions}
Get all active competitions based on current timestamp
fn get_active_competitions(
env: soroban_sdk::Env,
) -> soroban_sdk::Vec
Get the competition details
fn get_competition(env: soroban_sdk::Env, id: soroban_sdk::String) -> Competition
View all submitted artists and their metadata for a competition
fn get_comp_artists(
env: soroban_sdk::Env,
id: soroban_sdk::String,
) -> soroban_sdk::Vec<(soroban_sdk::String, ArtworkMetadata)>
Get the total pot for a competition
fn get_pot(env: soroban_sdk::Env, id: soroban_sdk::String) -> u64
Get the minimum token amount required to vote in a competition
fn get_min_vote_tokens(env: soroban_sdk::Env, id: soroban_sdk::String) -> u64
Get all contestants ranked by votes from winner to last place
fn get_winner(
env: soroban_sdk::Env,
id: soroban_sdk::String,
) -> soroban_sdk::Vec
Get all artists and their info stored on the contract
fn get_artists(
env: soroban_sdk::Env,
) -> soroban_sdk::Vec<(soroban_sdk::Address, ArtistInfo)>
Get artist info for a specific address
fn get_artist_info(
env: soroban_sdk::Env,
address: soroban_sdk::Address,
) -> Option
Get vote history for a competition
fn get_vote_history(
env: soroban_sdk::Env,
id: soroban_sdk::String,
) -> soroban_sdk::Vec
check if an wallet has registered artist info
fn has_registered(env: soroban_sdk::Env, address: soroban_sdk::Address) -> bool
Check if a voter voted
fn has_voted(
env: soroban_sdk::Env,
id: soroban_sdk::String,
voter: soroban_sdk::Address,
) -> Option
Check if a user can vote
fn check_voting_eligibility(
env: soroban_sdk::Env,
id: soroban_sdk::String,
voter: soroban_sdk::Address,
) -> VotingEligibility
Get the current admins of the contract
fn get_admins(
env: soroban_sdk::Env,
) -> (Option, Option)