Proxy Transfer

Proxy transfer allows the authorized party to transfer money through signature, which is generally used in trading platforms, and it can be used alone.

It can also be used in conjunction with freezing, and generally requires cooperation.

In order to prevent inconsistent signatures, ierc20 has developed a signature standard.

const message = JSON.stringify({
  title: 'ierc-20 one approve', // one approve
  to: '0x33302dbff493ed81ba2e7e35e2e8e833db023333', // platform address
  tick: 'ethi', // token
  amt: "333", // token amt
  value: "0.01", // eth value
  nonce: (+new Date()).toString(),
}, null, 4)

Through authorization, a signature can be obtained, and the same method will be used to verify it on the chain.

The verification code reference is as follows:

export const verifyMessage = (data: {
    tick: string;
    amt: string;
    nonce: string;
    value: string;
    sign: string;
}, seller: string) => {
    const message = JSON.stringify({
        title: 'ierc-20 one approve',
        to: DEX_ADDRESS, 
        tick: data.tick,
        amt: data.amt,
        value: data.value,
        nonce: data.nonce,
    }, null, 4)
    const recoveredAddress = ethers.utils.verifyMessage(message, data.sign)
    if(recoveredAddress.toLocaleLowerCase() === seller?.toLocaleLowerCase()){
        return {
            isVerify: true, 
            message
        }
    }else{
        return {
            isVerify: false, 
            message
        }
    }
}

The sending agent on the chain can also send to address 0,

But if you use ETH as the payment currency, then send it along with the amount and send it to the seller.

Key
Required
Description

p

yes

protocol name,ierc-20, there is no difference between the two.

op

yes

proxy_transfer

proxy

yes

array object, Agent information.

For example:

Last updated