Skip to content

2explos/A3SProtocol-v1

 
 

Repository files navigation

A3SProtocol

This repository contains A3SWalletFactory and A3SWallet smart contracts.

A3SWalletFactory

A3SWalletFactory is adjusted based on OpenZeppelin's ERC721 implementation. We provide the mintWallet function so that users can create a tradable A3SWallet contract address through this function.

mintWallet(address to,bytes32 salt,bool useFiatToken)

Parameters

  to: the address you want to assign the minted wallet to
  salt: 32 bytes of input to determine the generated wallet address, each salt can only be used once
  useFiatToken: if true, we will charge specified token as fee, else we will charge ether as fee

A3SWallet

A3SWallet provide two main functions, transferEther and generalCall.

transferEther(address to, uint256 amount)

Responsible for handling wallet transfers or withdrawals.

Parameters

  to: recipient address, you can withdraw ethers with given your target wallet address
  amount: number of ethers you want to transfer out from current wallet

generalCall(address contractAddress, bytes payload)

Responsible for handling interactions with any other contract, the user must provide the target contract address and the corresponding function payload.

Parameters

  contractAddress: target address you want to interact with
  payload: encoded functino call with parameters and basic infos

The contract functino payload can be calculated by web3.eth.abi.encodeFunctionCall from web3js

Example:

  // ERC20 transfer funcion abi example
let payload = await hre.web3.eth.abi.encodeFunctionCall(
  {
      name: "transfer",
      type: "function",
      inputs: [
          {
              type: "address",
              name: "to",
          },
          {
              type: "uint256",
              name: "amount",
          },
      ],
      outputs: [
          {
              type: "bool",
              name: "nopr",
          },
      ],
  },
  [address, "20"]
);

Follow us

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Solidity 96.1%
  • JavaScript 3.9%