Skip to content

fr0gsite/IPFSServerContract

Repository files navigation

IPFS Provider Contract

This repository contains an EOSIO smart contract that manages IPFS upload slots. Users can obtain slots either for free or by purchasing them with tokens. Each slot allows the contract owner to store metadata about uploaded files such as IPFS hashes.

Features

  • Configuration table: Stores parameters like free slots per user, daily limits and pricing.
  • Slot management: Users can claim a free slot using getslot and update their public key with setsec.
  • Uploads: The contract owner records file uploads via useslot, which decreases the user's slot count.
  • Purchasing slots: Users buy additional slots by transferring tokens with a buyslot memo.

The main contract implementation can be found under contracts/contract.cpp.

Building

The project uses the Bolt CLI. All commands are available through npm scripts:

npm install      # install dependencies (requires internet)
npm run build    # compiles the contract into the `build/` directory
npx @vaulta/bolt build # alternative command

If the npm install step fails due to network restrictions, make sure the required packages are preinstalled in node_modules.

Deploying

Deployment targets are defined in bolt.config.js. The example configuration includes a fr0g network that expects the environment variable PRIVATE_KEY for the deploying account.

For deployment you need to edit deployments/fr0g.ts (rename it from fr0g.ts.example) and replace 'youraccount' with your actual account name.

To deploy the contract:

export PRIVATE_KEY=...   # private key for the account listed in the config
npx @vaulta/bolt deploy fr0g

Testing

Unit tests are located in the tests/ directory and use the @eosnetwork/vert blockchain simulator. Run them with:

npx @vaulta/bolt test

Note that running tests requires all dev dependencies to be installed.

About

Smart Contract that manages IPFS uploads with slot system

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published