# Testing

In your, remix IDE open a new file and name it as PluginClient.sol and copy and paste the code contents.

Override your oracle address & job id in below client contract and deploy it in a remix by overriding the PLI mainnet address like below (Line numbers 21 & 22) in the smart contract to be replaced with your oracle contract address & job-id from the previous steps

```
// SPDX-License-Identifier: MIT
pragma solidity ^0.4.24;
import "https://github.com/GoPlugin/contracts/blob/main/src/v0.4/PluginClient.sol";
import "https://github.com/GoPlugin/contracts/blob/main/src/v0.4/vendor/Ownable.sol";
contract AlarmClockSample is PluginClient, Ownable {
    using Plugin for Plugin.Request;
    
    bool public alarmDone;
    address private oracle;
    bytes32 private jobId;
    uint256 private fee;
    
    /**
     * Network: Mainnet
     * Oracle: Plugin - 0xf180e56bb575806aefaf2a7616622a9fc180b51c
     * Job ID: Plugin - bcbac9232272445294102fdd1ee97c98
     * Fee: 0.1 PLI
     */
    constructor(address _pli) public Ownable() {
        setPluginToken(_pli);
        oracle = 0xf180e56bb575806aefaf2a7616622a9fc180b51c;
        jobId = "982105d690504c5e9ce374d040c08654";
        fee = 0.1 * 10 ** 18; // 0.1 PLI
        alarmDone = false;
    }
    
    /* Create a Plugin request to start an alarm and after the time in seconds is up, return throught the fulfillAlarm function */
    function requestAlarmClock(uint256 durationInSeconds) public returns (bytes32 requestId) 
    {
        Plugin.Request memory request = buildPluginRequest(jobId, address(this), this.fulfillAlarm.selector);
        // This will return in 90 seconds
        request.addUint("until", block.timestamp + durationInSeconds);
        return sendPluginRequestTo(oracle, request, fee);
    }
    
    /**
     * Receive the response in the form of uint256
     */ 
    function fulfillAlarm(bytes32 _requestId, uint256 _volume) public recordPluginFulfillment(_requestId)
    {
        alarmDone = true;
    }
function withdrawPli() public onlyOwner() { 
        PliTokenInterface pliToken = PliTokenInterface(pluginTokenAddress());
        require(pliToken.transfer(msg.sender, pliToken.balanceOf(address(this))), "Unable to transfer");
    }
}
```

![](https://1713380242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl1AVRR4cLSYjVp62RmtY%2Fuploads%2FtCYCLtJArndl0t6iJGj2%2Fimage.png?alt=media\&token=d6c13c85-a518-4a11-829e-2516eb4382c0)

After deployment, you will receive a contract address- In this case here it is -> **xdc**3017a414bf657a42fc183143e90d378f05ff0004

Fund your contract address with PLI ( let’s say 1 PLI) before you trigger the sleep task like below&#x20;

![](https://1713380242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl1AVRR4cLSYjVp62RmtY%2Fuploads%2Fl7RuGyQjKW6zs0xB3OlO%2Fimage.png?alt=media\&token=1265f839-d4f3-4cec-8ac5-ee7398d93647)

Once you submit the “requestAlarm”, a job will be triggered in your PLUGIN Node like below.

![](https://1713380242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl1AVRR4cLSYjVp62RmtY%2Fuploads%2Fa1e8tSyCN6Ocw55syY2E%2Fimage.png?alt=media\&token=53d4724e-2ce1-408d-890b-05f9cc9557ff)

After a couple of seconds, you should see the job is getting completed successfully

![](https://1713380242-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl1AVRR4cLSYjVp62RmtY%2Fuploads%2FkLP5tVLShyyD1dFfOF0E%2Fimage.png?alt=media\&token=7cee810c-1d0b-4c62-94c1-f28cdda7f96f)
