This repository contains the IO contract implementation on AO.
- Arweave Name System (ArNS) Registry - Core process code for the Arweave Name System Registry. It handles name registrations, updates, and queries within the ArNS framework.
- Gateway Registry - Lua module that handles the registration and management of AR.IO Gateways.
- Balances - Lua module that manages the balances of IO token holders.
-
Clone the repository and navigate to the project directory.
-
Install
lua
brew install [email protected]
-
Add the following to your
.zshrc
or.bashrc
file:echo 'export LDFLAGS="-L/usr/local/opt/[email protected]/lib"' >> ~/.zshrc echo 'export CPPFLAGS="-I/usr/local/opt/[email protected]/include"' >> ~/.zshrc echo 'export PKG_CONFIG_PATH="/usr/local/opt/[email protected]/lib/pkgconfig"' >> ~/.zshrc echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
-
Run
source ~/.zshrc
orsource ~/.bashrc
to apply the changes. -
Run
lua -v
to verify the installation.
-
Install
luarocks
curl -R -O http://luarocks.github.io/luarocks/releases/luarocks-3.9.1.tar.gz tar zxpf luarocks-3.9.1.tar.gz cd luarocks-3.9.1 ./configure --with-lua=/usr/local/opt/[email protected] --with-lua-include=/usr/local/opt/[email protected]/include make build sudo make install
-
Check the installation by running
luarocks --version
. -
Check the luarocks configuration by running
luarocks config | grep LUA
If you ever need to refresh .luarocks, run the following command:
luarocks purge && luarocks install ar-io-ao-0.1-1.rockspec
To load the module into the aos
REPL, run the following command:
aos --load contract/src/main.lua
The code is formatted using stylua
. To install stylua
, run the following command:
cargo install stylua
stylua contract
To run the tests, execute the following command:
busted .
To see the test coverage, run the following command:
luacov --reporter html && open luacov-html/index.html
To add new dependencies, install using luarocks to the local directory
luarocks install <package>
And add the package to the dependencies
table in the ar-io-ao-0.1-1.rockspec
file.
-- rest of the file
dependencies = {
"lua >= 5.3",
"luaunit >= 3.3.0",
"<package>"
}
TODO: