Assigning Authority

1Money Network provides optional protocol level role assignment for token operations that can can be delegated by the Master Authority to other account addresses. The Master Authority always retains super admin rights over all roles.

Example Code:

// 4. Grant authority for Minting and Burning
    println!("\n4. Grant Authority");
    println!("==================");

    let grant_payload = TokenAuthorityPayload {
        recent_checkpoint: checkpoint_info.number,
        chain_id,
        nonce: current_nonce,
        action: AuthorityAction::Grant,
        authority_type: Authority::MintBurnTokens,
        authority_address: recipient_address,
        token: token_address,
        value: TokenAmount::from(1000000000000000000u64), // 1 token allowance
    };
    current_nonce += 1; // Increment for next transaction

    match client.grant_authority(grant_payload, private_key).await {
        Ok(response) => {
            println!("Authority granted - Tx: {}", response.hash);
        }
        Err(e) => {
            print_detailed_error("Could not grant authority", &e);
        }
    }

Last updated