Skip to content

Commit

Permalink
royalties workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
juliancwirko committed Jan 24, 2022
1 parent bde4937 commit ca4c64a
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ You can always clone it and change it as you need. The best is to use the Elven
- Smart Contract in version 1 doesn't have many mechanisms which will strongly limit unwanted behaviors. It only implements random minting, but in version 2, there will be more mechanisms for fair launches.

#### TODO:
- implement `esdt_nft_create_as_caller` (waits for chain updates, it won't work for now)
- better docs
- tests
- additional nft roles management (optional with default set) (???)
Expand Down
7 changes: 7 additions & 0 deletions output/elven-nft-minter.abi.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,13 @@
],
"outputs": []
},
{
"name": "claimScFunds",
"onlyOwner": true,
"mutability": "mutable",
"inputs": [],
"outputs": []
},
{
"name": "mint",
"mutability": "mutable",
Expand Down
Binary file modified output/elven-nft-minter.wasm
Binary file not shown.
15 changes: 15 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,21 @@ pub trait ElvenTools {
Ok(())
}

// As an owner, claim Smart Contract balance - temporary solution for royalities, the SC has to be payable to be able to get royalties
#[only_owner]
#[endpoint(claimScFunds)]
fn claim_sc_funds(&self) -> SCResult<()> {
self.send().direct_egld(
&self.blockchain().get_caller(),
&self
.blockchain()
.get_sc_balance(&TokenIdentifier::egld(), 0),
&[],
);

Ok(())
}

// Main mint function - takes the payment sum for all tokens to mint.
#[payable("EGLD")]
#[endpoint(mint)]
Expand Down
1 change: 1 addition & 0 deletions wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ elrond_wasm_node::wasm_endpoints! {
(
callBack
changeBaseCids
claimScFunds
getDropTokensLeft
getNftPrice
getNftTokenId
Expand Down

0 comments on commit ca4c64a

Please sign in to comment.