Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

aepp-sophia-examples

AEproject

The project structure follows the default structure of AEproject which allows developers to easily run a local dev environment, test & deploy their Smart Contracts written in Sophia.

Note

  • This repository doesn't provide any deployment scripts as it is only intended to showcase Sophia Smart Contracts
  • All Sophia examples are provided with corresponding tests written in Javascript which can be found under ./test

Smart Contract Examples

Disclaimer

The provided Sophia examples are only tested to the extend represented. None of the code was security audited by aeternity or is provided to be used in production, without thorough checks.

Library Usage

The LibraryUsage.aes contract shows how to include default and custom libraries in a Smart Contract. The example currently includes following custom libraries:

Oracles

ExchangeOracles

  • ExchangeOracle.aes registers an oracle and allows to respond to oracle queries.
  • ExchangeMarket.aes showcases how to query prices from an oracle and how to get the answers of an oracle.

SmartDataProvider

There also exists another repository ae-oracle-pricefeed which includes a complete example that runs a server for the oracle which automatically extends the TTL of the oracle and responds to queries.

An even more complex example which aggregates answers of multiple oracles is included in tipping-oracle-service. The contracts in this repository are being used by https://superhero.com.

NFTs (Non Fungible Tokens)

Currently there doesn't exist an official NFT standard for aeternity. There is currently an active Grant application running where a NFT standard will be defined and implemented.

To get some inspiration how NFTs on aeternity could look like following examples are provided:

Smart Shop

This is a good example to see how to deal with contract interfaces to call remote contracts. All contracts can be found under contracts/SmartShop.

Workflow

  1. The Seller deploys the SellerContract by passing the buyer public address and item price as arguments.
  2. The Transport Courier deploys the TransportContract passing location as an argument.
  3. The Buyer passes SellerContract address and TransportContract address as arguments when deploying BuyerContract.
  4. The Buyer deposits the needed amount by calling deposit_to_seller_contract(), which takes the price of the item as Call.value.
  5. The Seller now sends the item, which will be redirected to Transport Courier. The function is send_item(). It checks if Buyer has deposited the price of the item to the SellerContract.
  6. Buyer can track the status of the item:
    • check_courier_status() - returns current delivery status
    • check_courier_location() - returns current location status
  7. Once the item is delivered, the Transport Courier calls delivered_item(city : string) function, with current location.
  8. To finalize the order, Buyer calls received_item() function, with SellerContract address.
  9. The amount of tokens, payed by Buyer, will be sent to seller's account.

Others (no specific explanation provided/required)

Training

The contracts in the folder contracts/Training are simple examples and have been created to serve the Educational content on aeternity development (YouTube).

Reference Implementations

There also exist reference implementations of Aeternity Expansions (AEX), the standards on aeternity proposed by the community. If you have a good idea or face common requirements you can also submit a new AEX proposal for which a reference implementation can be developed.

Problems / Questions

If you face a problem or have other questions please pick one of the following places:

We are happy to help!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published