Recent Artilces

BLOG

Economic Contract

← All Topics

gas.iost


GAS related contract, including pledging IOST for gas, unpleding, transferring GAS.
Details of economic model are introduced on GAS economic model

Info

contract_idgas.iost
languagenative
version1.0.0

API

pledge(pledgor, to, amount)

pledge iost for gas. minimum pledging amount is 1 iost.

Example

[“user1″,”user1″,”100”]:user1 pledge 100 iost for himslef. So user1 costs 100 iost, and obtains some gas.
[“user1″,”user2″,”100”]:user1 pledge 100 iost for user2. So user1 costs 100 iost, and user2 obtains some gas.

Parameter ListParameter TypeRemark
pledgorstringthe account who pledges iost. Calling this interface requires this account’s “transfer” permission
tostringthe account who gets gas
amountstringiost amount for pledging

unpledge

undo pledge. iost pledged earlier will be returned. minimum unpledging amount is 1 iost.

Example

[“user1″,”user1″,”100”]:user1 unpledge 100 iost from his earlier pledgement for himself.
[“user1″,”user2″,”100”]:user1 unpledge 100 iost from his earlier pledgement for user2.

Parameter ListParameter TypeRemark
pledgorstringthe account who pledges iost. Calling this interface requires this account’s “transfer” permission
tostringthe account who gets gas
amountstringiost amount for pledging

ram.iost


ram related contract, including buying/selling/transferring.
Details of economic model are introduced on RAM economic model.
You can get price estimate in RPC when you buy or sell a little ram.

Info

contract_idram.iost
languagejavascript
version1.0.0

API

buy(payer, receiver, amount)

buy RAM from system. minimum buying amount is 10 bytes.
contract will return the amount of iost costed.

Example

[“user1″,”user1”,1024]: user1 buys 1024 bytes ram for himself
[“user1″,”user2”,1024]: user1 buys 1024 bytes ram for user2

Parameter ListParameter TypeRemark
payerstringthe account who buys ram. Calling this interface requires this account’s “transfer” permission
receiverstringthe account who gets the bought ram
amountintram bytes to buy

sell(account, receiver, amount)

Sell unused ram to system. minimum selling amount is 10 bytes.
contract will return the amount of iost returned.

Example

[“user1″,”user1”,1024]: user1 sells unused 1024 bytes ram to system, he himself gets iost returned. 。
[“user1″,”user2”,1024]: user1 sells unused 1024 bytes ram to system, user2 gets iost returned.

Parameter ListParameter TypeRemark
payerstringthe account who sells ram. Calling this interface requires this account’s “transfer” permission
receiverstringthe account who gets the iost returned
amountintram bytes to sell

lend(from, to, amount)

transfer ram to others.
Only ram one bought can be transferred to others. So ram others transferred to you cannot be sold to system nor transferred to others.
minimum transferring amount is 10 bytes.

Example

[“user1″,”user2”,1024]: user1 transfers unused 1024 bytes ram to user2.

Parameter ListParameter TypeRemark
fromstringthe account who transfers ram. Calling this interface requires this account’s “transfer” permission
tostringthe account who receives ram
amountintram bytes to transfer
Last Updated On August 01, 2019
Vote For Us
Vote for IOST Watch and receive Daily IOST reward