Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
Mirrored projects
ink
Commits
7d19156e
Commit
7d19156e
authored
Jul 17, 2019
by
Satyam Agrawal
Committed by
Andrew Jones
Jul 17, 2019
Browse files
[core] add set_now, set_block_number, set_balance api for test env (#145)
parent
f54fac81
Changes
1
Hide whitespace changes
Inline
Side-by-side
core/src/env/test.rs
View file @
7d19156e
...
...
@@ -37,6 +37,21 @@ pub fn set_caller<T: EnvTypes>(address: T::AccountId) {
ContractEnv
::
<
T
>
::
set_caller
(
address
)
}
/// Sets the timestamp for the next contract invocation.
pub
fn
set_now
<
T
:
EnvTypes
>
(
timestamp
:
T
::
Moment
)
{
ContractEnv
::
<
T
>
::
set_now
(
timestamp
)
}
/// Sets the current block number for the next contract invocation.
pub
fn
set_block_number
<
T
:
EnvTypes
>
(
block_number
:
T
::
BlockNumber
)
{
ContractEnv
::
<
T
>
::
set_block_number
(
block_number
)
}
/// Sets the contract balance for the next contract invocation.
pub
fn
set_balance
<
T
:
EnvTypes
>
(
balance
:
T
::
Balance
)
{
ContractEnv
::
<
T
>
::
set_balance
(
balance
)
}
/// Returns an iterator over the uninterpreted bytes of all past emitted events.
pub
fn
emitted_events
<
T
:
EnvTypes
>
()
->
impl
Iterator
<
Item
=
Vec
<
u8
>>
{
ContractEnv
::
<
T
>
::
emitted_events
()
.into_iter
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment