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.
- Configuration table: Stores parameters like free slots per user, daily limits and pricing.
- Slot management: Users can claim a free slot using
getslotand update their public key withsetsec. - 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
buyslotmemo.
The main contract implementation can be found under contracts/contract.cpp.
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 commandIf the npm install step fails due to network restrictions, make sure the required packages are preinstalled in node_modules.
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 fr0gUnit tests are located in the tests/ directory and use the @eosnetwork/vert blockchain simulator. Run them with:
npx @vaulta/bolt testNote that running tests requires all dev dependencies to be installed.