templates.chain_id

 1import smartpy as sp
 2
 3
 4@sp.module
 5def main():
 6    class ChainId(sp.Contract):
 7        def __init__(self):
 8            self.data.chainId = None
 9
10        @sp.entrypoint
11        def test(self):
12            self.data.chainId = sp.Some(sp.chain_id)
13
14
15@sp.add_test()
16def chainIdTest():
17    scenario = sp.test_scenario("ChainId", main)
18    c = main.ChainId()
19    scenario += c
20    c.test(_chain_id=sp.chain_id_cst("0x9caecab8"))