Giter Club home page Giter Club logo

argent-contracts's Introduction

Argent Wallet Smart Contracts

The Argent wallet is an Ethereum Smart Contract based mobile wallet. The wallet's user keeps an Ethereum account (Externally Owned Account) secretly on his mobile device. This account is set as the owner of the Smart Contract. User's funds (ETH and ERC20 tokens) are stored on the Smart Contract. With that model, logic can be added to the wallet to improve both the user experience and the wallet security. For instance, the wallet is guarded, recoverable, lockable, and upgradable.

See full specifications here

Install

Ensure the correct node version is installed:

nvm install `cat .nvmrc`

Install requirements with npm:

npm install

Compile

Compile whole project

npm run cc

Compile the external contracts:

npm run compile:lib

Compile the contracts:

npm run compile

Compile the test contracts:

npm run compile:test

Copy the precompiled artefacts to the build directory:

npm run provision:lib:artefacts

Test

Add a .env file in the root of the directory with the INFURA_KEY property set to your Infura API key (if you need to do deployments) and similarly for ALCHEMY_KEY (if you need to run integration tests).

Launch ganache:

npm run ganache

Run the tests:

npm run test

To run coverage testing:

npm run test:coverage

You need to not have ganache running with this as it uses own instance.

License

Released under GPL-3.0

argent-contracts's People

Contributors

antoncoding avatar cgewecke avatar czhc avatar delaaxe avatar dependabot[bot] avatar elenadimitrova avatar eschnou avatar gergold avatar jpgonzalezra avatar juniset avatar leonprou avatar ligi avatar olivdb avatar paradisensei avatar sgc-code avatar shoenseiwaso avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

argent-contracts's Issues

Support different approve and call contracts for approveTokenAndCallContract

I'm a big fan of the approveTokenAndCallContract feature, it makes the user experience so much better when interacting with contracts that require allowances.

However, with some smart contract architectures like for instance 0x, the contract that the user needs to grant ERC20 allowance (ERC20Proxy) is different from the contract that executes the actual trade (exchange). This makes it impossible to use approveTokenAndCallContract for trading.

This problem could easily be resolved by not assuming that the allowance contract and the call contract are the same and instead letting the method caller pass the addresses for both.

TransferManager out of gas

Hey guys,

I try to deploy TransferManager but I'm getting out of gas error.
First I ran all the 6 basic scripts, and then I try to upgrade to new versions. Some of the upgrades are failing, I'm most interested in 10_upgrade_v1_4 because of the new TransferManager.
I get out of gas both on Kovan and ganache, so I think there's some error there. I noticed that you removed the old TokenTransfer module not so long ago, so maybe it's related.
txhash: https://kovan.etherscan.io/tx/0xba1ad6197c037a83333ea5e6ec9f6f420831c0d13d97df00a70821a6f44c43f2

USERNAME.argent.xyz

When opening the personal wallet website on mobile in Chrome shows everything mirrored.

Screenshot_2020-11-06-16-11-58-145_com android chrome

High GAS fees problem

Issue description

Looks interesting, unable to get good multisign wallet option like argent, only problem is high gas fees and to reduce GAS fees (near to zero ) would you consider to Add ETH compatible DPOS chain (XinFin Network) support?

here is the brief.
url: https://xinfin.network/
RPC: https://rpc.xinfin.network/
Addresses have prefix "xdc" instead of "0x"
no change in tx hashes
Remix : https://remix.xinfin.network/
Support solidity and smart contracts
other api: https://mycontract.co/

Happy to talk commercials as well as ready to support with large XinFin Community members support to grow adoption with argent team.

Use EIP-1167

Hi guys,

I was having a look at your codebase and was wondering if you were considering using EIP-1167 as a proxy for Argent’s wallets.

EIP-1167 is becoming a widely use standard and it may optimize gas costs and provide interesting network-effect advantages [like Etherscan automatically linking to the implementation].

As your current proxy does not allow to upgrade the implementation address anyhow that would be a perfect fit.

Just my two cents :)

[FEATURE REQUEST] Add security policy

Is your feature request related to a problem? Please describe.
There appears to be no way to understand what to do if there is a security bug

Describe the solution you'd like
Add a policy to the security tab

Describe alternatives you've considered
Can be in the readme but the security tab is probably best

Additional context
Happy to help with a pull request if given some guidance

TransferManager transferToken using relay not working on mainnet

Hi,
I'm trying to use transferToken on the TransferManager using the execute method of the RelayerModule but it doesn' work.
The transaction is mined successfully, but nothing happens and there's one log event which I think is a sign for success=false at the end.
Calling transferToken directly on the TransferManager works perfectly though.
Any leads will be appreciated.
Thanks

Declare the contract in the Cairo 1 wallet

Issue description

pl: Execution was reverted; failure reason: [0x617267656e742f696e76616c69642d74782d76657273696f6e].

Built the contract in Cairo 0, but after upgrading the Argent X wallet to Cairo 1, declaring the contract resulted in an error.

pl: Execution was reverted; failure reason: [0x617267656e742f696e76616c69642d74782d76657273696f6e].

PS: decoded hex(0x617267656e742f696e76616c69642d74782d76657273696f6e) -> str "?argent/invalid-tx-version"

How to subscribe to native eth transfer log?

Hi team! I am trying to subscribe to native ETH transfer log such as the ones here: https://etherscan.io/tx/0x7357f1f0885811b2888dad7e7b1aa0f3016c7b0f8a179e37e463d5e941889bab#eventlog under topics[0]: 0x7d2476ab50663f025cff0be85655bcf355f62768615c0c478f3cd5293f807365

I am wondering where I can find the event associated with this log? I am trying to unpack the event but it does not have an event name. Is this an anonymous event and how can I subscribe to the event properly?

One way that I can think of is to get all the other indexed topics under the above topics[0] but I really want to know if there's a standard way to do this with abi unpacking the event?

Questions about the fallback function of BaseWallet

I am an engineer developing a contract wallet. The upgradability based on the Argent's modular structure is very advanced and smart compared to other contract wallets, so I'm using it as a reference for development. Thank you for making such a great product public.

...However, there are some codes that I cannot fully understand with my own knowledge. If possible, could you tell me about the design intents of them?

Specifically, I have the following questions about the fallback function of BaseWallet.

  • Q1. Why isn't it reverted even if the enabled module doesn't exist?
    • For a normal contract without fallback, it is reverted if the specified function selector does not exist.
  • Q2. Why are only static calls delegated?
    • Is there any significant risk if call is used instead of staticcall?
    • I understand that there is a risk of storage slot clash and function selector clash when delegatecall is used.
fallback() external payable {
    address module = enabled(msg.sig);
    if (module == address(0)) {
        emit Received(msg.value, msg.sender, msg.data);
    } else {
        require(authorised[module], "BW: unauthorised module");

        // solhint-disable-next-line no-inline-assembly
        assembly {
            calldatacopy(0, 0, calldatasize())
            let result := staticcall(gas(), module, 0, calldatasize(), 0, 0)
            returndatacopy(0, 0, returndatasize())
            switch result
            case 0 {revert(0, returndatasize())}
            default {return (0, returndatasize())}
        }
    }
}

Android and iOS application source code

Issue description

I didn't manage to find the source code for the android and iOS applications.

While its appreciable to have the smart contracts used by argent open source, its equally important to open source the client applications as key generation and storage is still handled by the argent applications among many other reasons (security, reproducibility, privacy concerns, etc)

Repeated warnings during tests: "WARNING: Multiple definitions for isRegisteredModule"

There were many warnings emitted during the tests, most of which are the same warning,
"WARNING: Multiple definitions for isRegisteredModule

Would just like to know if this is an expected behavior or not, and if so, I would love to understand why this is emitted or where is it from, as I am unable to find any resources of this online.
After skimming through the tests slightly, suspect might be caused by modules being reloaded/re-deployed everytime in beforeEach hooks.

AcidStainArt2

Issue description 0x3c8D2FCE49906e11e71cB16Fa0fFeB2B16C29638imageimage

Censorship resistance of the Android and iOS applications

Issue description

How censorship resistant are the argent android and iOS applications?
In terms of what RPC endpoints do they rely on, if any and if any critical functionality can be disabled by taking out specific endpoint or disabling/blocking a DNS domain, etc

These are questions that I think the argent teams needs to consider and address especially since the applications are not yet open sourced and available outside the play store yet, in situations where governments and states where there are not favourable regulations for cryptocurrencies and argent manages to gain a fair market share in those markets only for the government to then decide to ban this specific applications for socio-political reasons.

Running Test Error

When executing the tests.

etherlime test test/compoundManager_invest.js

Running all tests also give a out-to-gas exception.

In the compound contract Comptroller.sol is causing the revert.

uint changeStatus = unitroller._acceptImplementation();

compilation issue

Hi,
I'm trying to run npm compile on the develop branch and getting the following errors:

 Compilation warnings encountered:

/Users/liorrabin/Dev/fuse/argent-contracts/lib/ens/ENS.sol:36:31: Warning: This declaration shadows an existing declaration.
    function isApprovedForAll(address owner, address operator) external view returns (bool);
                              ^-----------^
/Users/liorrabin/Dev/fuse/argent-contracts/lib/ens/ENS.sol:32:5: The shadowed declaration is here:
    function owner(bytes32 node) external view returns (address);
    ^-----------------------------------------------------------^
,/Users/liorrabin/Dev/fuse/argent-contracts/contracts/wallet/WalletFactory.sol:142:23: Warning: The "create2" instruction is only available for Constantinople-compatible VMs. You are currently compiling for "byzantium", where it will be interpreted as an invalid instruction.
            wallet := create2(0, add(code, 0x20), mload(code), newsalt)
                      ^-----------------------------------------------^
,/Users/liorrabin/Dev/fuse/argent-contracts/contracts/wallet/WalletFactory.sol:175:23: Warning: The "create2" instruction is only available for Constantinople-compatible VMs. You are currently compiling for "byzantium", where it will be interpreted as an invalid instruction.
            wallet := create2(0, add(code, 0x20), mload(code), newsalt)
                      ^-----------------------------------------------^


{ Error: /Users/liorrabin/Dev/fuse/argent-contracts/lib/ens/ENS.sol:36:31: Warning: This declaration shadows an existing declaration.
    function isApprovedForAll(address owner, address operator) external view returns (bool);
                              ^-----------^
/Users/liorrabin/Dev/fuse/argent-contracts/lib/ens/ENS.sol:32:5: The shadowed declaration is here:
    function owner(bytes32 node) external view returns (address);
    ^-----------------------------------------------------------^
,/Users/liorrabin/Dev/fuse/argent-contracts/contracts/modules/CommunityManager.sol:13:5: TypeError: Wrong argument count for modifier invocation: 2 arguments given but expected 3.
    BaseModule(_registry, NAME)
    ^-------------------------^
,/Users/liorrabin/Dev/fuse/argent-contracts/contracts/modules/WalletOwnershipManager.sol:13:5: TypeError: Wrong argument count for modifier invocation: 2 arguments given but expected 3.
    BaseModule(_registry, NAME)
    ^-------------------------^
,/Users/liorrabin/Dev/fuse/argent-contracts/contracts/wallet/WalletFactory.sol:142:23: Warning: The "create2" instruction is only available for Constantinople-compatible VMs. You are currently compiling for "byzantium", where it will be interpreted as an invalid instruction.
            wallet := create2(0, add(code, 0x20), mload(code), newsalt)
                      ^-----------------------------------------------^
,/Users/liorrabin/Dev/fuse/argent-contracts/contracts/wallet/WalletFactory.sol:175:23: Warning: The "create2" instruction is only available for Constantinople-compatible VMs. You are currently compiling for "byzantium", where it will be interpreted as an invalid instruction.
            wallet := create2(0, add(code, 0x20), mload(code), newsalt)
                      ^-----------------------------------------------^
    at new ExtendableError (/Users/liorrabin/Dev/fuse/argent-contracts/node_modules/etherlime/cli-commands/compiler/etherlime-error/index.js:7:19)
    at new CompileError (/Users/liorrabin/Dev/fuse/argent-contracts/node_modules/etherlime/cli-commands/compiler/etherlime-compile/compile-error.js:11:5)
    at Promise (/Users/liorrabin/Dev/fuse/argent-contracts/node_modules/etherlime/cli-commands/compiler/etherlime-compile/index.js:81:18)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  message:
   '/Users/liorrabin/Dev/fuse/argent-contracts/lib/ens/ENS.sol:36:31: Warning: This declaration shadows an existing declaration.\n    function isApprovedForAll(address owner, address operator) external view returns (bool);\n                              ^-----------^\n/Users/liorrabin/Dev/fuse/argent-contracts/lib/ens/ENS.sol:32:5: The shadowed declaration is here:\n    function owner(bytes32 node) external view returns (address);\n    ^-----------------------------------------------------------^\n,/Users/liorrabin/Dev/fuse/argent-contracts/contracts/modules/CommunityManager.sol:13:5: TypeError: Wrong argument count for modifier invocation: 2 arguments given but expected 3.\n    BaseModule(_registry, NAME)\n    ^-------------------------^\n,/Users/liorrabin/Dev/fuse/argent-contracts/contracts/modules/WalletOwnershipManager.sol:13:5: TypeError: Wrong argument count for modifier invocation: 2 arguments given but expected 3.\n    BaseModule(_registry, NAME)\n    ^-------------------------^\n,/Users/liorrabin/Dev/fuse/argent-contracts/contracts/wallet/WalletFactory.sol:142:23: Warning: The "create2" instruction is only available for Constantinople-compatible VMs. You are currently compiling for "byzantium", where it will be interpreted as an invalid instruction.\n            wallet := create2(0, add(code, 0x20), mload(code), newsalt)\n                      ^-----------------------------------------------^\n,/Users/liorrabin/Dev/fuse/argent-contracts/contracts/wallet/WalletFactory.sol:175:23: Warning: The "create2" instruction is only available for Constantinople-compatible VMs. You are currently compiling for "byzantium", where it will be interpreted as an invalid instruction.\n            wallet := create2(0, add(code, 0x20), mload(code), newsalt)\n                      ^-----------------------------------------------^\n\u001b[31mCompilation failed. See above.\u001b[39m',
  stack:
   'Error: /Users/liorrabin/Dev/fuse/argent-contracts/lib/ens/ENS.sol:36:31: Warning: This declaration shadows an existing declaration.\n    function isApprovedForAll(address owner, address operator) external view returns (bool);\n                              ^-----------^\n/Users/liorrabin/Dev/fuse/argent-contracts/lib/ens/ENS.sol:32:5: The shadowed declaration is here:\n    function owner(bytes32 node) external view returns (address);\n    ^-----------------------------------------------------------^\n,/Users/liorrabin/Dev/fuse/argent-contracts/contracts/modules/CommunityManager.sol:13:5: TypeError: Wrong argument count for modifier invocation: 2 arguments given but expected 3.\n    BaseModule(_registry, NAME)\n    ^-------------------------^\n,/Users/liorrabin/Dev/fuse/argent-contracts/contracts/modules/WalletOwnershipManager.sol:13:5: TypeError: Wrong argument count for modifier invocation: 2 arguments given but expected 3.\n    BaseModule(_registry, NAME)\n    ^-------------------------^\n,/Users/liorrabin/Dev/fuse/argent-contracts/contracts/wallet/WalletFactory.sol:142:23: Warning: The "create2" instruction is only available for Constantinople-compatible VMs. You are currently compiling for "byzantium", where it will be interpreted as an invalid instruction.\n            wallet := create2(0, add(code, 0x20), mload(code), newsalt)\n                      ^-----------------------------------------------^\n,/Users/liorrabin/Dev/fuse/argent-contracts/contracts/wallet/WalletFactory.sol:175:23: Warning: The "create2" instruction is only available for Constantinople-compatible VMs. You are currently compiling for "byzantium", where it will be interpreted as an invalid instruction.\n            wallet := create2(0, add(code, 0x20), mload(code), newsalt)\n                      ^-----------------------------------------------^\n    at new ExtendableError (/Users/liorrabin/Dev/fuse/argent-contracts/node_modules/etherlime/cli-commands/compiler/etherlime-error/index.js:7:19)\n    at new CompileError (/Users/liorrabin/Dev/fuse/argent-contracts/node_modules/etherlime/cli-commands/compiler/etherlime-compile/compile-error.js:11:5)\n    at Promise (/Users/liorrabin/Dev/fuse/argent-contracts/node_modules/etherlime/cli-commands/compiler/etherlime-compile/index.js:81:18)\n    at process._tickCallback (internal/process/next_tick.js:68:7)',
  name: 'CompileError' }

import WalletConnectProvider from "@walletconnect/web3-provider";

import WalletConnectProvider from "@walletconnect/web3-provider";

// Create WalletConnect Provider
const provider = new WalletConnectProvider({
rpc: {
1: "https://mainnet.mycustomnode.com",
3: "https://ropsten.mycustomnode.com",
100: "https://dai.poa.network",
// ...
},
});

// Enable session (triggers QR Code modal)
await provider.enable();

__Originally posted by @AcidStainArt in https://github.com/argentlabs/argent-contracts/issues/309__![image](https://user-images.githubusercontent.com/115077752/196020636-fb413be2-737f-4b20-881e-c95b7136f45f.jpeg)![image](https://user-images.githubusercontent.com/115077752/196020655-48fa9dff-80b0-4979-ba23-ff8616fc695d.jpeg)

Is this Smart Contract up to date?

Issue description

I am trying to play around with this Smart Contract, and I compiled it only to have a series of errors and squiggles. I tried to make sense of it by posting the log error to GPT, and here are some of the responses I found below which I can confirm in the code.

Screenshot 2023-10-30 at 16 19 11

How did Argent compile this Smart Contract without getting Shadowing Function Declarations or Shadowing Variables in Inline Assembly? I also do hope there are instructions on how to personally adapt/use this Smart Contract.

Checksum Addresses

Checksum Addresses when scanning through QR Code

Application: Android
Unsure if this applies to iOS, as I know the two apps do not have feature parity, I also do not know if that is still true.

Issue: Argent does not return a checksum (i.e. validation and encoding) of addresses.

Example

0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed = true

0x5AAEB6053f3e94c9b9a09f33669435e7ef1beaed = false

Severity: low-risk, no funds at risk

Informative:
checksum addresses through this simple interface

Add fee to TransferManager

Hi,
We want to add a fee mechanism to the transferToken function in TransferManager.
We're calling it using the execute function of the RelayerModule.
My question is who will be the msg.sender in the transferToken function? is it the wallet owner or the account actually sending the transactions?
Thanks

Use Local Memory Type Variable Instead of Global Storage Type Variable in Event to Save Gas

Hi, we recently have conducted a systematic study about Solidity event usage, evolution, and impact, and we are attempting to build a tool to improve the practice of Solidity event use based on our findings. We have tried our prototype tool on some of the most popular GitHub Solidity repositories, and for your repository, we find a potential optimization of gas consumption arisen from event use.

The point is that when we use emit operation to store the value of a certain variable, local memory type variable would be preferable to global storage type (state) variable if they hold the same value. The reason is that an extra SLOAD operation would be needed to access the variable if it is storage type, and the SLOAD operation costs 800 gas.

For your repository, we find that the following event use can be improved:

  • DSAuth.sol
    function name:setOwner
    event name:  LogSetOwner
    variable:    owner->owner_
    function setOwner(address owner_)
        public
        auth
    {
        owner = owner_;
        emit LogSetOwner(owner);
    }

Do you find our results useful? Your reply and invaluable suggestions would be greatly appreciated, and are vital for improving our tool. Thanks a lot for your time!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.