Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request - Add abandon() function to allow funds to be returned #16

Open
DouglasHorn opened this issue Oct 30, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@DouglasHorn
Copy link

DouglasHorn commented Oct 30, 2022

When an account sends TLOS to works.decide those funds are assigned to the account's funds in the accounts table. This prevents accounts from returning unused funds to Telos Works. An abandon() function is needed that would work exactly like the 'withdraw()' function but without transferring tokens.

An account that holds a balance in the accounts table should be able to abandon those funds with the result that the amount of funds abandoned will be subtracted from the account's entry on the accounts table without sending funds to the account.

Suggested code:

works.hpp insert at line 95

    //abandon funds from account balance
    ACTION abandon(name account_name, asset quantity);

works.cpp Insert at line 682

ACTION works::abandon(name account_name, asset quantity) {

    //authenticate
    require_auth(account_name);

    //validate
    check(quantity.symbol == TLOS_SYM, "can only abandon TLOS");
    check(quantity.amount > 0, "can only abandon a positive amount");

    //subtract balance from account
    sub_balance(account_name, quantity);

}

Update human-language contracts

@DouglasHorn DouglasHorn added the enhancement New feature or request label Oct 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant