Skip to content

Commit

Permalink
burn method removed -> token interface removed
Browse files Browse the repository at this point in the history
  • Loading branch information
sagars committed Sep 19, 2024
1 parent a74b7b7 commit 4b08999
Showing 1 changed file with 8 additions and 26 deletions.
34 changes: 8 additions & 26 deletions contracts/balanced_doller/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use crate::errors::ContractError;
use crate::metadata::{read_decimal, read_name, read_symbol, write_metadata};
use crate::states::{has_administrator, read_administrator, write_administrator};
use crate::storage_types::{DataKey, INSTANCE_BUMP_AMOUNT, INSTANCE_LIFETIME_THRESHOLD};
use soroban_sdk::token::{self, Interface as _};
use soroban_sdk::{contract, contractimpl, panic_with_error, Address, Bytes, BytesN, Env, String, Vec};
use soroban_token_sdk::metadata::TokenMetadata;
use soroban_token_sdk::TokenUtils;
Expand Down Expand Up @@ -98,15 +97,12 @@ impl BalancedDollar {
.instance()
.extend_ttl(INSTANCE_LIFETIME_THRESHOLD, INSTANCE_BUMP_AMOUNT);
}
}

#[contractimpl]
impl token::Interface for BalancedDollar {
fn allowance(e: Env, from: Address, spender: Address) -> i128 {
pub fn allowance(e: Env, from: Address, spender: Address) -> i128 {
read_allowance(&e, from, spender).amount
}

Check warning on line 103 in contracts/balanced_doller/src/contract.rs

View check run for this annotation

Codecov / codecov/patch

contracts/balanced_doller/src/contract.rs#L101-L103

Added lines #L101 - L103 were not covered by tests

fn approve(e: Env, from: Address, spender: Address, amount: i128, expiration_ledger: u32) {
pub fn approve(e: Env, from: Address, spender: Address, amount: i128, expiration_ledger: u32) {
from.require_auth();

check_nonnegative_amount(amount);
Expand All @@ -117,11 +113,11 @@ impl token::Interface for BalancedDollar {
.approve(from, spender, amount, expiration_ledger);
}

fn balance(e: Env, id: Address) -> i128 {
pub fn balance(e: Env, id: Address) -> i128 {
read_balance(&e, id)
}

fn transfer(e: Env, from: Address, to: Address, amount: i128) {
pub fn transfer(e: Env, from: Address, to: Address, amount: i128) {
from.require_auth();

check_nonnegative_amount(amount);
Expand All @@ -130,7 +126,7 @@ impl token::Interface for BalancedDollar {
TokenUtils::new(&e).events().transfer(from, to, amount);
}

Check warning on line 127 in contracts/balanced_doller/src/contract.rs

View check run for this annotation

Codecov / codecov/patch

contracts/balanced_doller/src/contract.rs#L120-L127

Added lines #L120 - L127 were not covered by tests

fn transfer_from(e: Env, spender: Address, from: Address, to: Address, amount: i128) {
pub fn transfer_from(e: Env, spender: Address, from: Address, to: Address, amount: i128) {
spender.require_auth();

check_nonnegative_amount(amount);
Expand All @@ -141,29 +137,15 @@ impl token::Interface for BalancedDollar {
TokenUtils::new(&e).events().transfer(from, to, amount)
}

Check warning on line 138 in contracts/balanced_doller/src/contract.rs

View check run for this annotation

Codecov / codecov/patch

contracts/balanced_doller/src/contract.rs#L129-L138

Added lines #L129 - L138 were not covered by tests

fn burn(e: Env, from: Address, amount: i128) {
balanced_dollar::_burn(&e, from, amount);
}

fn burn_from(e: Env, spender: Address, from: Address, amount: i128) {
spender.require_auth();

check_nonnegative_amount(amount);

spend_allowance(&e, from.clone(), spender, amount);
spend_balance(&e, from.clone(), amount);
TokenUtils::new(&e).events().burn(from, amount)
}

fn decimals(e: Env) -> u32 {
pub fn decimals(e: Env) -> u32 {
read_decimal(&e)
}

Check warning on line 142 in contracts/balanced_doller/src/contract.rs

View check run for this annotation

Codecov / codecov/patch

contracts/balanced_doller/src/contract.rs#L140-L142

Added lines #L140 - L142 were not covered by tests

fn name(e: Env) -> String {
pub fn name(e: Env) -> String {
read_name(&e)
}

Check warning on line 146 in contracts/balanced_doller/src/contract.rs

View check run for this annotation

Codecov / codecov/patch

contracts/balanced_doller/src/contract.rs#L144-L146

Added lines #L144 - L146 were not covered by tests

fn symbol(e: Env) -> String {
pub fn symbol(e: Env) -> String {
read_symbol(&e)
}

Check warning on line 150 in contracts/balanced_doller/src/contract.rs

View check run for this annotation

Codecov / codecov/patch

contracts/balanced_doller/src/contract.rs#L148-L150

Added lines #L148 - L150 were not covered by tests
}
Expand Down

0 comments on commit 4b08999

Please sign in to comment.