github.com/FUSIONFoundation/efsn@v3.6.2-0.20200916075423-dbb5dd5d2cc7+incompatible/contracts/fsn/FSNExample.sol (about)

     1  pragma solidity ^0.5.4;
     2  
     3  import "https://github.com/cross-chain/efsn/contracts/fsn/FSNContract.sol";
     4  
     5  contract FSNExample is FSNContract {
     6      address owner;
     7      modifier onlyOwner {
     8          require(msg.sender == owner, "only owner");
     9          _;
    10      }
    11  
    12      constructor() public {
    13          owner = msg.sender;
    14      }
    15  
    16      // If a contract want to receive Fusion Asset and TimeLock from an EOA,
    17      // the contract must impl the following 'receiveAsset' interface.
    18      function receiveAsset(bytes32 assetID, uint64 startTime, uint64 endTime, SendAssetFlag flag, uint256[] memory extraInfo) payable public returns (bool success) {
    19          (assetID, startTime, endTime, flag, extraInfo); // silence warning of Unused function parameter
    20          return true;
    21      }
    22  
    23      // impl by calling a precompiled contract '0x9999999999999999999999999999999999999999'
    24      // which support send out Fusion Asset and TimeLock from the calling contract.
    25      function sendAsset(bytes32 asset, address to, uint256 value, uint64 start, uint64 end, SendAssetFlag flag) onlyOwner public returns (bool success) {
    26          (success,) = _sendAsset(asset, to, value, start, end, flag);
    27          require(success, "call sendAsset failed");
    28          return true;
    29      }
    30  }