Skip to content

Commit

Permalink
Merge pull request #176 from aptos-labs/angie/script_bulk_renewal
Browse files Browse the repository at this point in the history
[ans] add script for bulk renewal
  • Loading branch information
angieyth authored Oct 4, 2023
2 parents 84d0167 + afa8551 commit 8168649
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bulk_force_renewal/Move.toml
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"
11 changes: 11 additions & 0 deletions bulk_force_renewal/README.md
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`
24 changes: 24 additions & 0 deletions bulk_force_renewal/sources/script.move
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,
)
}
}
}

0 comments on commit 8168649

Please sign in to comment.