-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
11 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,11 @@ | ||
# Archway Network Starter Pack | ||
# ArchwayID Manager | ||
|
||
This is a template to build smart contracts in Rust to run inside a | ||
[Cosmos SDK](https://github.com/cosmos/cosmos-sdk) module on all chains that enable it. | ||
To understand the framework better, please read the overview in the | ||
[archway repo](https://github.com/archway-network/archway/blob/main/README.md), | ||
and dig into the [archway docs](https://docs.archway.io). | ||
## Key Functionalities | ||
|
||
The below instructions assume you understand the theory and just want to get coding. | ||
- Automatic Domain Renewal. Automatically extend your domains before they expire. The smart contract schedules the renewal to occur several days before the expiration date. Users have the option to cancel the renewal and receive a refund at any time. | ||
- Set Default Domain. If you own multiple domains, you can easily select one as your default domain. | ||
- Domain Renewal. Renew your domain directly with ease. | ||
|
||
## Creating a new project from a template | ||
## How It Works | ||
|
||
Assuming you have a recent version of rust and cargo (v1.51.0+) installed | ||
(via [rustup](https://rustup.rs/)), | ||
then the following should get you a new repo to start a contract: | ||
|
||
Install [cargo-generate](https://github.com/ashleygwilliams/cargo-generate) and cargo-run-script. | ||
If you didn't install them already, run the following commands: | ||
|
||
```sh | ||
cargo install cargo-generate --features vendored-openssl | ||
cargo install cargo-run-script | ||
``` | ||
|
||
Now, use it to create your new contract. | ||
Go to the folder in which you want to place it and run: | ||
|
||
```sh | ||
cargo generate --git https://github.com/archway-network/archway-templates.git --name PROJECT_NAME default | ||
``` | ||
|
||
You will now have a new folder called `PROJECT_NAME` (I hope you changed that to something else) | ||
containing a simple working contract and build system that you can customize. | ||
|
||
## Create a Repo | ||
|
||
After generating, you have a initialized local git repo, but no commits, and no remote. | ||
Go to a server (eg. github) and create a new upstream repo (called `YOUR-GIT-URL` below). | ||
Then run the following: | ||
|
||
```sh | ||
# this is needed to create a valid Cargo.lock file (see below) | ||
cargo check | ||
git branch -M main | ||
git add . | ||
git commit -m 'Initial Commit' | ||
git remote add origin YOUR-GIT-URL | ||
git push -u origin main | ||
``` | ||
|
||
## CI Support | ||
|
||
We have template configurations for [GitHub Actions](.github/workflows/Basic.yml) in the generated project, | ||
so you can get up and running with CI right away. | ||
|
||
One note is that the CI runs all `cargo` commands | ||
with `--locked` to ensure it uses the exact same versions as you have locally. This also means | ||
you must have an up-to-date `Cargo.lock` file, which is not auto-generated. | ||
The first time you set up the project (or after adding any dep), you should ensure the | ||
`Cargo.lock` file is updated, so the CI will test properly. This can be done simply by | ||
running `cargo check` or `cargo unit-test`. | ||
|
||
## Using your project | ||
|
||
Once you have your custom repo, you should check out [Developing](./Developing.md) to explain | ||
more on how to run tests and develop code. Or go through the | ||
[online tutorial](https://docs.archway.io/docs/create/guides/my-first-dapp/start) to get a better feel | ||
of how to develop. | ||
|
||
[Publishing](./Publishing.md) contains useful information on how to publish your contract | ||
to the world, once you are ready to deploy it on a running blockchain. And | ||
[Importing](./Importing.md) contains information about pulling in other contracts or crates | ||
that have been published. | ||
|
||
Please replace this README file with information about your specific project. You can keep | ||
the `Developing.md` and `Publishing.md` files as useful referenced, but please set some | ||
proper description in the README. | ||
The ArchID auto-renewal functionality relies on the callback module. The admin of the smart contract can start a "cron" job that executes approximately every 7 days by registering a callback with the callback module. Upon execution, this "cron" job performs two tasks. First, it triggers the next callback to be executed in the next 7 days. Second, it checks whether any ArchID is going to expire in the upcoming 7 days. If it finds any, it triggers another callback to renew the domain. This process repeats until there are no more expiring domains in the list. This cycle continues indefinitely until the admin stops it or the contract runs out of funds. |