core-contracts | Core contracts: reference staking pool, lockup, voting, whitelist, multisig | Cryptocurrency library
kandi X-RAY | core-contracts Summary
kandi X-RAY | core-contracts Summary
Core contracts: reference staking pool, lockup, voting, whitelist, multisig.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of core-contracts
core-contracts Key Features
core-contracts Examples and Code Snippets
Community Discussions
Trending Discussions on core-contracts
QUESTION
In the
internal_restake
function, why do we have to access theon_stake_action
function as if it's an external cross contract call when its a function thats a part of the calling contract? Couldn't we just do.then(self.on_stake_action())
instead? I'm assuming it has something to do with the face that it's a callback fromstake()
promise call.In what situation would you make an interface for the contract itself like
ext_self
?What does the #[ext_contract()] macro do in a nutshell?
-------- Staking Pool Contract Code Below -------------------- lib.rs lines 155~162
ANSWER
Answered 2021-May-11 at 14:47The reason for the "external" interface for the contract is that the call to the method is external since it is "called" as part of a promise action.
QUESTION
if I send a transaction with 2 contract fn calls, does the 2nd gets executed if the 1st fails?
sample code:
...ANSWER
Answered 2020-Oct-30 at 19:12All later actions after the first failed action are not executed. And their execution fees are refunded. All the changes that were successfully executed before, will be reverted and all the promises will not be scheduled and executed either.
Your case is more complicated, because the first action succeeds by returning a promise. The resulting promise later will fails in the callback, but the second action fails immediately, because the staking pool is not selected yet due to async execution. So the first promise doesn't get scheduled.
EDIT 1.
Once a transaction or a receipt succeeds (finishes all actions) it doesn't rollback anything. So if any future promises fail they are going to be independently executing from each other. Also only the last action in a batch of actions returns the result for the entire receipt.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install core-contracts
Rust is installed and managed by the rustup tool. Rust has a 6-week rapid release process and supports a great number of platforms, so there are many builds of Rust available at any time. Please refer rust-lang.org for more information.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page