Skip to content
This repository has been archived by the owner on Nov 3, 2024. It is now read-only.

Commit

Permalink
add url to create
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisCarriere committed Oct 12, 2023
1 parent b5d323e commit b8ac674
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,12 +345,13 @@ Create bounty
- `{name} author_user_id` - author (EOSN Login ID)
- `{name} bount_id` - bounty ID
- `{symbol_code} accepted_token` - accepted deposit token (ex: `"USDT"`)
- `{string} url` - bounty URL (ex: GitHub issue URL)
- `{optional<name>} bounty_type` - bounty type (default = traditional)

### Example

```bash
$ cleos push action work.pomelo create '[author.eosn, bounty1, "USDT", null]' -p author.eosn
$ cleos push action work.pomelo create '[author.eosn, bounty1, "USDT", "https://github.com/pomelo-io/pomelo-rest-api/issues/735", null]' -p author.eosn
```

## ACTION `setmetadata`
Expand Down
4 changes: 3 additions & 1 deletion work.pomelo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void pomelo::deltoken( const symbol_code symcode )

// @author
[[eosio::action]]
void pomelo::create( const name author_user_id, const name bounty_id, const symbol_code accepted_token, const optional<name> bounty_type )
void pomelo::create( const name author_user_id, const name bounty_id, const symbol_code accepted_token, const string url, const optional<name> bounty_type )
{
eosn::login::require_auth_user_id( author_user_id, get_configs().login_contract );

Expand Down Expand Up @@ -84,6 +84,7 @@ void pomelo::create( const name author_user_id, const name bounty_id, const symb
row.permissions = "approval"_n;
row.created_at = current_time_point();
row.updated_at = current_time_point();
row.metadata["url"_n] = url;
});
pomelo::createlog_action createlog( get_self(), { get_self(), "active"_n });
createlog.send( bounty_id, author_user_id, extended_symbol{ token.sym, token.contract }, type, "approval"_n );
Expand Down Expand Up @@ -187,6 +188,7 @@ void pomelo::setconfig( const optional<name> status, const optional<uint64_t> fe
if ( login_contract ) configs.login_contract = *login_contract;
if ( fee_account ) configs.fee_account = *fee_account;
if ( metadata_keys.size() ) configs.metadata_keys = metadata_keys;
configs.metadata_keys.insert("url"_n); // always include url by default
_configs.set( configs, get_self() );
}

Expand Down
5 changes: 3 additions & 2 deletions work.pomelo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,16 +236,17 @@ class [[eosio::contract("work.pomelo")]] pomelo : public eosio::contract {
* - `{name} author_user_id` - author (EOSN Login ID)
* - `{name} bount_id` - bounty ID
* - `{symbol_code} accepted_token` - accepted deposit token (ex: `"USDT"`)
* - `{string} url` - bounty URL (ex: GitHub issue URL)
* - `{optional<name>} bounty_type` - bounty type (default = traditional)
*
* ### Example
*
* ```bash
* $ cleos push action work.pomelo create '[author.eosn, bounty1, "USDT", null]' -p author.eosn
* $ cleos push action work.pomelo create '[author.eosn, bounty1, "USDT", "https://github.com/pomelo-io/pomelo-rest-api/issues/735", null]' -p author.eosn
* ```
*/
[[eosio::action]]
void create( const name author_user_id, const name bounty_id, const symbol_code accepted_token, const optional<name> bounty_type );
void create( const name author_user_id, const name bounty_id, const symbol_code accepted_token, const string url, const optional<name> bounty_type );

/**
* ## ACTION `setstate`
Expand Down

0 comments on commit b8ac674

Please sign in to comment.