Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
beem
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
beem
Commits
ca283573
Commit
ca283573
authored
3 years ago
by
Martin Lees
Browse files
Options
Downloads
Patches
Plain Diff
rc ops
parent
880cecda
No related branches found
No related tags found
1 merge request
!6
Extension in 'update_proposal' is internally created
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
beem/rc.py
+54
-0
54 additions, 0 deletions
beem/rc.py
with
54 additions
and
0 deletions
beem/rc.py
+
54
−
0
View file @
ca283573
...
...
@@ -228,3 +228,57 @@ class RC(object):
execution_time_count
=
resource_execution_time
[
"
account_update_operation_exec_time
"
]
resource_count
=
self
.
get_resource_count
(
tx_size
,
execution_time_count
,
state_bytes_count
)
return
self
.
blockchain
.
get_rc_cost
(
resource_count
)
def
set_slot_delegator
(
self
,
from_pool
,
to_account
,
to_slot
,
signer
):
"""
Set a slot to receive RC from a pool
:param str from_pool: Pool to set the slot to
:param str to_account: Account on which we want to update the slot
:param int to_slot: slot we want to set
:param str signer: Account who broadcast this
"""
json_body
=
[
'
set_slot_delegator
'
,
{
'
from_pool
'
:
from_pool
,
'
to_account
'
:
to_account
,
'
to_slot
'
:
to_slot
,
'
signer
'
:
signer
,
}
]
return
self
.
blockchain
.
custom_json
(
"
rc
"
,
json_body
,
required_auths
=
[
signer
])
def
delegate_from_pool
(
self
,
from_pool
,
to_account
,
max_rc
):
"""
Set a slot to receive RC from a pool
:param str from_pool: Pool to set the slot to
:param str to_account: Account on which we want to update the slot
:param int max_rc: max rc to delegate
"""
json_body
=
[
'
delegate_drc_from_pool
'
,
{
'
from_pool
'
:
from_pool
,
'
to_account
'
:
to_account
,
'
asset_symbol
'
:
{
'
nai
'
:
"
@@000000037
"
,
'
decimals
'
:
6
},
"
drc_max_mana
"
:
max_rc
,
}
]
return
self
.
blockchain
.
custom_json
(
"
rc
"
,
json_body
,
required_auths
=
[
from_pool
])
def
delegate_to_pool
(
self
,
username
,
to_pool
,
rc
):
"""
Set a slot to receive RC from a pool
:param str username: user delegating rc to the pool
:param str to_pool: Pool to delegate to
:param str rc: rc to delegate
"""
json_body
=
[
'
delegate_to_pool
'
,
{
'
from_account
'
:
username
,
'
to_pool
'
:
to_pool
,
'
amount
'
:
{
'
symbol
'
:
"
VESTS
"
,
'
amount
'
:
rc
,
'
precision
'
:
6
,
'
nai
'
:
'
@@000000037
'
},
}
]
return
self
.
blockchain
.
custom_json
(
"
rc
"
,
json_body
,
required_auths
=
[
username
])
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment