Skip to content

Oyase-shinobi/Soroban-contract

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Soroban contract examples

Here you can find soroban contract examples. I try to improve and update these contracts continuously with new features and feedback provided by other developers.

Ballot without token

This contract manages a ballot process following a custodial approach. Allowed-to-vote users are stored in the contract storage. When a user wants to vote, He does not need to sign a transactión with his wallet but the application would be in charge of storing the vote in the contract.

Ballot

This contract also manages a ballot process but, in this case, the user must hold a token to be able to vote. The token is defined by the BallotToken contract (ballot/BallotToken). The user must sign the transaction with his wallet since authorization is required and, before storing the vote, the contract ensures the user address holds the token checking the balance.

House Purchase

This contract manages a house purchase between buyer and seller. It uses another contract which acts as an asset and represents the underlying asset, that is, the house. After the buyer send the payment to the current asset owner, it changes the ownership of the asset to the buyer.

Paid Account

The Paid Account contract allows users to deposit tokens (a previously established token) in the contract address and earn daily interest. The contract provides functions for administrators so that the contract always has funds when users request withdrawals.

Simple deposit

A contract to make a simple deposit to the contract address.


IMPORTANT: These contracts have a test suite but they have not been audited. They can serve as a base for learning but not for being used directly in a real application without being audited first.

Test the contracts

To test the contracts, you must prepare first your environment. Follow the soroban official documentation to achieve it. After having the environment ready, follow the next steps:

Build the contract

cargo build

Test the contract

cargo test

The last commands must be executed inside the contract root folder. For instance: soroban-contracts/paid_account.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages