How do I deliberately add a delay in my Token, ETH and NFT transfer?

The functionality in the link below isn’t sufficient as I seem to need a bespoke solution.
However, I feel like if explain my desired functionality, you might be able to help me out.
[https://docs.moralis.io/moralis-server/sending-assets] (https://moralis Docs).

According to the documentation, the code below perfectly sends 0.5 tokens directly
from the 0x…002 wallet to 0x…01 the wallet**,** which works absolutely fine!

// sending 0.5 tokens with 18 decimals
const options = {type: "erc20",
                 amount: Moralis.Units.Token("0.5", "18"),
                 receiver: "0x...001",
                 contractAddress: "0x...002"}
 
let result = await Moralis.transfer(options)

However, the desired functionality I am looking for is a transfer that is deliberately delayed (by a date set by the wallet owner ), whilst a service fee is sent to the
serviceProviderAddress . Before this transfer date elapses, the ETH, token, or NFTS or whatever asset are to be transferred remains in the sender’s/owners possession/wallet until the specified date.

I have tried to explain in code below, kindly take a look.

// sending 0.5 tokens with 18 decimals
const options = {type: "erc20",
                 amount: Moralis.Units.Token("0.5", "18"),
                 receiver: "0x...001",
                   delayedTransferTo: "2022-10-01T18:00:00.000Z", 
                   serviceFee: Eth.Units.Token("0.0039"), 
                   serviceProviderAddress: "0x...099",
                 contractAddress: "0x...002"}
 
let result = await Moralis.transfer(options)

To further clarify my code above:

  • the transfer of 0.5 tokens from contractAddress:0x…002 to the receivers wallet 0x…001 will only occur during the specified date: “2022-10-01T18:00:00.000Z”,

  • however the contractAddress:0x…002 wallet will immediately be debited for the service (serviceFee of Unit. Token 0.0039) and deposited to the service provider’s wallet serviceProvidersAddress:0x…099.

  • Before the specified date delayedTransferTo: “2022-10-01T18:00:00.000Z”, has eleapsed, the the 0.5 tokens should remain in the owners possession.

Kindly help me realise my Dapp by explaining how I can achieve the above via Moralis code.

Looking forward to hearing from you.

Vincent

you may need to implement that logic in a smart contract in order to support those parameters:

1 Like

Firstly thank you very much for your valued response!

In an attempt to realise the transfer delay of ERC721 tokens, I have taken the time to learn the solidity language, but seem to be stuck and need a bit of assistance.

Find below my post on the moralis forum: Using openZepplin, how do I use the safeTransferFrom(from, to, tokenId, "")?

Though I have gotten some help, I thought you might be able to also help me out?

Thanks in advance