Token (gETH)
- class geodefi.Token
Token object is created with respect to the provided API’s chainId.# will refer to Token instance of initiated Geode instance, as gETH.
gETH = geode.token
Class Attributes
Functions
ERC1155 Standarts
- Token.functions.name(None)
Returns the
nameof chain specific token.
gETH.functions.name().call()
# 'Geode Staked Ether'
- Token.functions.mint(to, id, amount, data)
“Creates amount new tokens for to, of token type id.
See {ERC1155-_mint}. Requirements: - the caller must have the MINTER_ROLE.”
Warning
The minting can already be done on Portal.
gETH.functions.mint('0xd3CdA913deB6f67967B99D67aCDFa1712C293601',5,1000000000000000000,'').buildTransaction(**config)
- Token.functions.mintBatch(to, id[], amount[], data)
“Creates amount new tokens for to, of token type id. Enables multiple tokens with specific amounts.
# address,uint256[],uint256[],bytes
gETH.functions.mintBatch('0xd3CdA913deB6f67967B99D67aCDFa1712C293601',[5,12431254],[1000000000000000000,500000000000000000]'').buildTransaction(**config)
- Token.functions.balance(account, id)
accountcannot be the zero address.
Returns the
balanceof gETH token withidof the givenaccount.
# address,uint256
gETH.functions.balance('0xd3CdA913deB6f67967B99D67aCDFa1712C293601',5).call()
# 1000000000000000000
- Token.functions.balanceOfBatch(accounts[], ids[])
Batch version of above function. Inputs are list, outputs are list. * address[],uint256[] * accounts and ids must have the same length.”
- Token.functions.denominator()
Returns the
denominatorof gETH token. (1e18)
# 1e18
gETH.functions.denominator().call()
# 1000000000000000000
- Token.functions.symbol()
Returns the
symbolof gETH token. (1e18)
gETH.functions.symbol().call()
# 'gETH'
- Token.functions.totalSupply(uint256 poolID)
Returns the
totalSupplyinteger of the given Pool Id.
# Check Pools page to see how to get pool ID.
poolID = 50016835115526216130031110555486827201953559012021267556883950029143900999178
gETH.functions.totalSupply(poolID).call()
# 32000000000000000000
- Token.functions.burn(account, id, value)
accountcannot be the zero address.
Burns the
valueof gETH token withidof the givenaccount.
# address,uint256
gETH.functions.burn('0xd3CdA913deB6f67967B99D67aCDFa1712C293601',5, 1e18).buildTransaction()
- Token.functions.burnBatch(accounts, ids[], values[])
Batch version of above function. Inputs are list, outputs are list. * address[],uint256[] * accounts and ids must have the same length.”
- Token.functions.safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes memory data)
accountcannot be the zero address.
Burns the
valueof gETH token withidof the givenaccount.
# address,uint256
gETH.functions.safeTransferFrom(addr1, addr2, id, 1e18, '').buildTransaction()
- Token.functions.safeBatchTransferFrom(address to, ids[], amount[], '')
amounts: uint256[], ids: uint256[]
amounts and ids must have the same length.”
Batch version of above function. Inputs are list, outputs are list.
Middlewares
The ERC1155 standard can host multiple tokens and ensures that the entire system works in the ERC1155 standard.
Depending on the structure, users can set middleware to certain tokens in line and make it functions as ERC20.
- Token.functions.isMiddleware(address middleware, uint256 id)
Check if an address is approved as an middleware for an ID
gETH.functions.isMiddleware('0xaa..', 3).call()
# True
- Token.functions.setMiddleware(address middleware, uint256 id, bool isSet)
Set an address of a contract that will act as a middleware on gETH contract for a specific ID
gETH.functions.setMiddleware('0xaa..', 3, True).buildTransaction()
Avoiders
Users can avoid the effect of the
middlewarefunctionalities.
- Token.functions.isAvoider(address account, uint256 id)
Checks if the given address restricts the affect of the middlewares on their gToken
gETH.functions.isAvoider('0xaa..', 3).call() # True
- Token.functions.avoidMiddlewares(uint256 id, bool isAvoid)
Restrict any affect of middlewares on the tokens of caller
isAvoid-truerestrict middlewares,false: allow middlewaresgETH.functions.avoidMiddlewares(3, True).buildTransaction()
Roles
- Token.functions.DEFAULT_ADMIN_ROLE()
Returns the
DEFAULT_ADMIN_ROLEof gETH token. Only this address have permission to run admin functions. For details check docs.geode.fi.# bytes32 gETH.functions.DEFAULT_ADMIN_ROLE().call() # 'b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'' # hex-string gETH.functions.DEFAULT_ADMIN_ROLE().call().hex() # '0000000000000000000000000000000000000000000000000000000000000000'
- Token.functions.PAUSER_ROLE()
Returns the
PAUSER_ROLEof gETH token. Only this address have permission to run pause/unpause functions. For details check docs.geode.fi.# bytes32 gETH.functions.PAUSER_ROLE().call() # 'b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'' # hex-string gETH.functions.PAUSER_ROLE().call().hex() # '0000000000000000000000000000000000000000000000000000000000000000'
- Token.functions.MINTER_ROLE()
Returns the
MINTER_ROLEof gETH token. Only this address have permission to run mint functions. For details check docs.geode.fi.# bytes32 gETH.functions.MINTER_ROLE().call() # 'b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'' # hex-string gETH.functions.MINTER_ROLE().call().hex() # '0000000000000000000000000000000000000000000000000000000000000000'
- Token.functions.ORACLE_ROLE()
Returns the
ORACLE_ROLEof gETH token. Only this address have permission to run oracle functions. For details check docs.geode.fi.# bytes32 gETH.functions.ORACLE_ROLE().call() # 'b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'' # hex-string gETH.functions.ORACLE_ROLE().call().hex() # '0000000000000000000000000000000000000000000000000000000000000000'
- Token.functions.MIDDLEWARE_MANAGER_ROLE()
Returns the
MIDDLEWARE_MANAGER_ROLEof gETH token. Only this address have permission to run middleware functions. For details check docs.geode.fi.See the Middlewares section below.
# bytes32 gETH.functions.MIDDLEWARE_MANAGER_ROLE().call() # 'b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'' # hex-string gETH.functions.MIDDLEWARE_MANAGER_ROLE().call().hex() # '0000000000000000000000000000000000000000000000000000000000000000'
- Token.functions.URI_SETTER_ROLE()
Returns the
URI_SETTER_ROLEof gETH token. Only this address have permission to set URIs to access ipfs data in ERC1155. For details check docs.geode.fi.# bytes32 gETH.functions.URI_SETTER_ROLE().call() # 'b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'' # hex-string gETH.functions.URI_SETTER_ROLE().call().hex() # '0000000000000000000000000000000000000000000000000000000000000000'
- Token.functions.transferMinterRole(address new_minter_address)
Changes the
MINTER_ROLEof gETH token.gETH.functions.transferMinterRole(newMinter).buildTransaction()
- Token.functions.transferOracleRole(address new_address)
Changes the
ORACLE_ROLEof gETH token.gETH.functions.transferOracleRole(newOracle).buildTransaction()
- Token.functions.transferPauserRole(address new_address)
Changes the
PAUSER_ROLEof gETH token.gETH.functions.transferPauserRole(address newPauser).buildTransaction()
- Token.functions.transferMiddlewareManagerRole(address new_address)
Changes the
MIDDLEWARE_MANAGER_ROLEof gETH token.gETH.functions.transferMiddlewareManagerRole(address newMiddlewareManager).buildTransaction()
- Token.functions.transferUriSetterRole(address newURISetter)
Changes the
URI_SETTER_ROLEof gETH token.gETH.functions.transferUriSetterRole(newURISetter).buildTransaction()
Pausing
- Token.functions.paused()
Gets bool variable whether contract has paused or not.
gETH.functions.paused().call()
- Token.functions.pause()
Pauses all token transfers and approvals.
gETH.functions.pause().buildTransaction()
- Token.functions.unpause()
Unpauses all token transfers and approvals.
gETH.functions.unpause().buildTransaction()