chain_extension.sol 456 B

123456789101112
  1. import "polkadot";
  2. contract ChainExtension {
  3. // Implementation on the node:
  4. // https://github.com/hyperledger-solang/solang-substrate-ci/blob/substrate-integration/runtime/src/chain_ext.rs#L43
  5. function fetch_random(bytes32 _seed) public returns (bytes32) {
  6. bytes seed = abi.encode(_seed);
  7. (uint32 ret, bytes output) = chain_extension(1101, seed);
  8. assert(ret == 0);
  9. return abi.decode(output, (bytes32));
  10. }
  11. }