Assessment reports>Initia>Threat Model>Module reward.move

Module reward.move

Function: register_reward_store

This is an internal function used to create the reward store.

Inputs

Full prototype: public(friend) fun register_reward_store<Vesting: copy + drop + store>( chain: &signer, bridge_id: u64, )

  • Type Vesting<copy + drop + store>

    • Validation: Not validated but only called internally with valid arguments.

    • Impact: The type of the vesting (either user or operator). It is only used for determining the hash seed for the object.

  • chain: &signer

    • Validation: None, but it must be a signer.

    • Impact: Used as the source address for creating the reward-store address.

  • bridge_id: u64

    • Validation: None, but the creation will fail if the reward store already exists.

    • Impact: The bridge ID for which the reward store is created.

Function: add_reward_per_stage

This is an internal function used to update the internally accounted amount of reward for a given stage in the reward store. The actual reward coins are directly deposited.

Inputs

Full prototype: public(friend) fun add_reward_per_stage( reward_store_addr: address, stage: u64, reward: u64 ) acquires RewardStore

  • reward_store_addr: address

    • Validation: None, but must be able to acquire the reward store there.

    • Impact: The reward store whose stage reward is updated.

  • stage: u64

    • Validation: None, but this function only has trusted callers.

    • Impact: The stage for which the rewards are updated.

  • reward: u64

    • Validation: None, but this function only has trusted callers.

    • Impact: This amount is added to the stage reward at the reward store.

Function: withdraw

Internal function that withdraws reward coins from this reward store.

Inputs

Full prototype: public(friend) fun withdraw( reward_store_addr: address, amount: u64, ): FungibleAsset acquires RewardStore

  • reward_store_addr: address

    • Validation: None, but it must be able to acquire the reward store there.

    • Impact: The reward store that is withdrawn from.

  • amount: u64

    • Validation: None, but this function only has trusted callers.

    • Impact: The amount to withdraw.

Zellic © 2024Back to top ↑