인게임 통화
Sui Closed-Loop Token standard를 사용하면 in-game currency를 생성할 수 있다. 이는 플레이어의 행동에 대해 지급하거나 구매할 수 있게 만들 수 있는 gems나 diamonds 같은 in-game assets 형태일 수 있다. 이 currency는 Sui에서 mint하지만, 플레이어는 게임 자체의 경제 안에서만 사용할 수 있다. 일반적으로 희소성과 게임 경제를 유지하기 위해 미리 정한 수량으로 mint한다.
이 예시는 Move로 governance-controlled currency를 구 현한다. Currency를 transfer하려면 approval이 필요하며, 이는 custom rule logic으로 구현된다. 이 예시의 currency는 King Credits이며, Crown Council의 approval이 있어야만 transfer할 수 있다.
Currency 초기화
King Credits currency를 만들려면 coin_registry::new_currency_with_otw module을 사용해 currency를 초기화하고 token::add_rule_for_action으로 currency policy를 구성한다:
I3/king_credits/sources/king_credits.move. You probably need to run `pnpm prebuild` and restart the site.init functions는 package publish event 중에만 실행된다.
Custom transfer rules 설정
다른 Move package에서 add_rule_config function을 구현해 초기 council members로 rule configuration을 초기화하고, members 최대 수에 제한 을 설정하며, 그 수가 최대값을 초과하지 않는지 확인하는 check를 포함한다.
add_council_member와 remove_council_member functions는 council members를 추가하고 제거한다. prove function은 request sender가 council member인지 확인하고, 맞다면 rule에 approval을 추가한다:
I3/king_credits/sources/crown_council_rule.move. You probably need to run `pnpm prebuild` and restart the site.