-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #176 from aptos-labs/angie/script_bulk_renewal
[ans] add script for bulk renewal
- Loading branch information
Showing
3 changed files
with
44 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[package] | ||
name = 'aptos_names_bulk_force_renewal' | ||
version = '1.0.0' | ||
|
||
[addresses] | ||
repository = "_" | ||
|
||
[dependencies.aptos_names_v2_1] | ||
local = "../core_v2" |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
This script helps with bulk name renewal as an admin. It will overrule the renewal window and the max renewal period. | ||
|
||
Preparation: | ||
1. Update `Move.toml` with the correct `repository` account. | ||
2. Use the admin account to run the script. | ||
|
||
Each iteration: | ||
1. Update the script with the appropriate names to renew | ||
2. Update the time period to renew the names for | ||
3. Compile the script: `aptos move compile` | ||
4. Run the script: `aptos move run-script --compiled-script-path bulk_force_renewal/build/aptos_names_bulk_force_renewal/bytecode_scripts/main.mv --profile admin` |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
script { | ||
use std::option; | ||
use aptos_framework::timestamp; | ||
|
||
const SECONDS_PER_YEAR: u64 = 60 * 60 * 24 * 365; | ||
|
||
fun main(admin: &signer) { | ||
let names = vector [ | ||
b"name01", | ||
b"name02", | ||
]; | ||
let years_to_expire = 100; | ||
|
||
while (!std::vector::is_empty(&names)) { | ||
let name = std::string::utf8(std::vector::pop_back(&mut names)); | ||
aptos_names_v2_1::v2_1_domains::force_set_name_expiration( | ||
admin, | ||
name, | ||
option::none(), | ||
timestamp::now_seconds() + SECONDS_PER_YEAR * years_to_expire, | ||
) | ||
} | ||
} | ||
} |