Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 10 2017 22:42
    @jpitts banned @etherchamp1_twitter
  • Jun 05 2016 10:33
    @chriseth banned @adamskee
S0AndS0
@s0ands0:matrix.org
[m]

@qq5678: TLDR the syntax is __address_to__.transfer(__amount__) where __address_to__ is the address to send funds, and __amount__ is the amount in Wei to send.

Here's an example for demonstrating how to deposit and withdraw from a smart contract;

Account.sol

// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.7;

/// @title Example contract for holding and distributing funds
/// @author S0AndS0
contract Account {
    address payable public owner;
    uint256 public balance;

    ///
    constructor(address payable _owner) payable {
        owner = _owner;
        balance = msg.value;
    }

    ///
    function deposit() external payable {
        balance += msg.value;
    }

    ///
    function withdraw(uint256 _amount) external {
        require(msg.sender == owner, "Message sender not contract owner");
        require(_amount <= balance, "Insufficient funds for withdraw");
        owner.transfer(_amount);
        balance -= _amount;
    }
}

And for completeness here's an example of how to initialize, and pay, a smart contract from a separate factory contract... plus a few bonus features;

Bank.sol

// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.7;

/// @title Example factory for making new accounts and getting initialized accounts
/// @author S0AndS0
contract Bank {
    /* Account.owner to address(Account) */
    mapping(address => address) accounts;

    ///
    function initializeAccount(address payable _account_owner)
        external
        payable
        returns (Account)
    {
        require(
            accounts[_account_owner] == address(0x0),
            "Account already initalized"
        );

        Account _account = (new Account){ value: msg.value }(_account_owner);
        accounts[_account_owner] = address(_account);
        return _account;
    }

    ///
    function getAccount(address _account_owner)
        external
        view
        returns (Account)
    {
        address _account_reference = accounts[_account_owner];
        require(_account_reference != address(0x0), "Account not initalized");
        return Account(_account_reference);
    }
}
ETHERUEMconsultant2018
@ETHERUEMconsultant2018
Hello . How can I send ether from smart contract to a person ? I have this line of code but is not working payable(address(this).balance).transfer(member1); it returns me this error TypeError: Explicit type conversion not allowed from "uint256" to "address payable"Contact eth@consultant.com
jamesdabr
@jamesdabr
not sure what member1 is but I assume it is an address?
so maybe member1.transfer(address(this).balance) ?
femi omoshona
@femostic4j
Greating to everyone, pls guys, how can do i get a script with this similar interface like this https://candlegenie.io/prediction for my projects. Pls any hint or idea will go a long way. Thanks
femi omoshona
@femostic4j
I working on a project @ this point i need a landing page similar to this https://candlegenie.io/prediction for my projects. How do get similar script for my landing page. Pls any hint or idea will go a long way. Thanks
stardust
@stardusty:matrix.org
[m]
Is there anyway to prevent duplication of NFT tokens between L1 and L2? I'm having a situation where the minter could technically mint the same token ID on both L1 and L2. Since the token contract is deployed on both L1 and L2 with the mint function, the minter could really just mint the same token ID on both chains. There wouldn't be a way to recognise which token is the real one when this happens.
1 reply
Muhammad Zaryab Rafique
@Zaryab-Programmer
CompilerError: Stack too deep when compiling inline assembly: Variable dataEnd is 1 slot(s) too deep inside the stack.
kindly guide me in this error
Peteris Erins
@Pet3ris

I'm trying to install Solidity compiler to work with Z3 (Mac). I tried 2 things:

1) I installed from source with Z3 present brew install solidity (from what I understand in the documentation the build should install with Z3 support unless explicitly disabled with a flag)
2) I installed z3 separately brew install z3

Then I run solc simple.sol --model-checker-engine bmc --model-checker-solvers z3, however, solc is reporting the following:

Warning: BMC analysis was not possible since no SMT solver was found and enabled.

Any idea how to get this to work?

4 replies
Jim Lynch
@WebWhizJim_twitter
Member "mod" not found or not visible after argument-dependent lookup in uint256.
anyone know how I can fix this error?
I am following chainlink docs which seem to be totally wrong and outdated... lol
chriseth
@chriseth:matrix.org
[m]
@WebWhizJim_twitter: it looks like you are missing a using statement
cameel
@cameel:matrix.org
[m]

It's hard to tell what's really happening without more details. Do you have cmake output from the build?
You could submit an issue with more details in the bug tracker and we'll investigate.

As a workaround, you could try our own formula that has a dependency on z3: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/solidity.rb
Or try a static binary from solc-bin - these have Z3 statically compiled-in: https://github.com/ethereum/solc-bin/tree/gh-pages/macosx-amd64

fm-b
@fm-b
Hi everyone,
Is it important that what version of compiler we should use?
Are latest versions ok or not?
cameel
@cameel:matrix.org
[m]
@fm-b: Use the latest one.
fm-b
@fm-b
@cameel:matrix.org tnx
MY001
@MYsuanliFeng_twitter
Hello everyone, is anyone interested in Bitcoin, Ethereum, Filecoin mining?
monkeyontheloose
@monkeyontheloo2_twitter
hey hey, wondering what is the solidity operator/function that is max (gas price / actual compute price)
Alexander Lee
@partylikeits1983
Hey everyone! I was wondering if you could take a look at my smart contract and give me some feedback: https://github.com/partylikeits1983/DividendPayingDAO
Robert Oschler
@roschler
Is it possible to get stack traces from from the Ethereum MainNet or one of the TestNets too? My understanding is that it is possible to run a full Ethereum node configured to maintain state persistence and then you can get a stack traces from it. But I have not tried it myself, so I am wondering I can get stack traces from the MainNet or from a TestNet (or self-owned full node) that has been configured that way. Anyone have experience with stack traces on reverted transactions? If so, what tool do I use to get that given a TX ID. Truffle? Hard Hat? etc. Also, any comments on how practical it is to do this, regardless of it being theoretically possible, would be welcome. If this is not the right Gitter channel for this question, please let me know what is.
1 reply
Nick Mudge
@mudgen
I want to let it be known that there is a job board specifically for Solidity jobs here: https://delegatecall.careers/
Berk Serbetcioglu
@berkserbet
Thanks Nick, I'm looking for a freelance solidity dev. Are there freelance jobs there?
1 reply
Nick Mudge
@mudgen
there can be
Gary
@garysdevil
I can't update storage variable by calling another contract from one contract and transfer value, who can give me a favour
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0; 
contract Test1{
    uint private a1 = 11;

    function get()  public view returns (uint){
        return a1;
    }
    function set(uint a) public{
        a1=a;
    }
   function set1() public  {
       a1=22;      
   }
    fallback() external {
        a1=33;
    }
}
contract Test2{
    function call_1(address contractAddress) public{
         (bool success,bytes memory a) =contractAddress.call(abi.encodeWithSignature("set(uint)",44));
        require(success);
    }
   function call_2(address contractAddr) public {
      (bool success,) = contractAddr.call(abi.encodeWithSignature("set1()")); require(success);
      require(success);
   }
}
function "call_1" does not work
STST
@STST00960379_twitter
你好 有人说话吗?
Gary
@garysdevil
怎么了?
DIIMIIM
@DIIMIIM2_twitter
Hello! Does anyone know why nested struct getters return them empty when called via call()? (They work if called from web3js, for example)
1 reply
MY001
@MYsuanliFeng_twitter
Hey! friend.
I am a cryptocurrency investor and a confidential currency mining machine salesperson.
Our company currently sells BTC, ETH, FIL and other mining machines. At the same time, celebrate the first anniversary of Filecoin's launch on the mainnet. 🤜🤛
Currently, there are discounts for mining machines. Filecoin is the only digital certificate of IPFS, and its value will be very high in the future.
Interested friends can scan the QR code to add my contact information.
Gary
@garysdevil

I can't update storage variable by calling another contract from one contract and transfer value, who can give me a favour

I solved

Ding Tian
@ReactTop_gitlab
Hi everyone
What is main difference between ERC721 and ERC1155? which is better to mint NFT ?
KaiRo
@kairo:mozilla.org
[m]
ERC721 is a real NFT. ERC1155 can be NFT-like or fungible tokens, and mainly is there because you can have different kinds of tokens in one token contract
Parham
@parhamrm
Hey guys
I'm stuck recovering signer of a typedData(EIP712) in solidity
I've deployed a minimal version of rarible-protocol
const DOMAIN_TYPE = [
    {
        type: 'string',
        name: 'name'
    },
    {
        type: 'string',
        name: 'version'
    },
    {
        type: 'uint256',
        name: 'chainId'
    },
    {
        type: 'address',
        name: 'verifyingContract'
    }
];

const domainData = {
    name: 'Market721',
    version: '1',
    chainId: '1337',
    verifyingContract: '0x296564F6260b95f99F93fB347d456b7FC825771b'
};

const OrderTypes = {
    AssetType: [
        { name: 'assetClass', type: 'bytes4' },
        { name: 'data', type: 'bytes' }

    ],
    Asset: [
        { name: 'assetType', type: 'AssetType' },
        { name: 'value', type: 'uint256' }
    ],
    Order: [
        { name: 'maker', type: 'address' },
        { name: 'makeAsset', type: 'Asset' },
        { name: 'taker', type: 'address' },
        { name: 'takeAsset', type: 'Asset' }
    ]
};

const createTypeData = (domain, primaryType, message, types) => {
    return {
        types: { EIP712Domain: DOMAIN_TYPE, ...types },
        domain,
        primaryType,
        message
    };
};
const leftUH = {
        maker: "0xfa6954192c3087f9143f5401f7804b405ac84ca5",
        makeAsset: {
            assetType: {
                assetClass: id('ERC20'),
                data: web3.eth.abi.encodeParameter('address', '0xfa6954192c3087f9143f5401f7804b405ac84ca5')
            },
            value: BigNumber("100000000")
        },
        taker: "0x3bed4334ce380cfe41363c7e875a9fc1769578b1",
        takeAsset: {
            assetType: {
                assetClass: id('ERC721'),
                data: web3.eth.abi.encodeParameter({ root: { contract: "address", tokenId: "uint256" }}, { contract: '0xfa6954192c3087f9143f5401f7804b405ac84ca5', tokenId: 1 })
            },
            value: "1"
        }
    };
const leftMsgParams = createTypeData(domainData, 'Order', leftUH, OrderTypes)
    const leftSig = sigUtil.signTypedData_v4(Buffer.from(leftAcc, 'hex'), { data: leftMsgParams });
Parham
@parhamrm
const resault = await market.matchOrders(leftUH, leftSig, rightUH, rightSig);
and when I recover signer in solidity it doesn't match with order.maker which is signer of the order
Ding Tian
@ReactTop_gitlab
Who can explain about EIP-2981 exactly?
MY001
@MYsuanliFeng_twitter
Hey! friend.
I am a cryptocurrency investor and a confidential currency mining machine salesperson.
Our company currently sells BTC, ETH, FIL and other mining machines. At the same time, celebrate the first anniversary of Filecoin's launch on the mainnet. 🤜🤛
Currently, there are discounts for mining machines. Filecoin is the only digital certificate of IPFS, and its value will be very high in the future.
Interested friends can scan the QR code to add my contact information.
http://api.suanlifeng.com/wap/invite/04372723/e8b146e412fb16354e7a4454d623619c/global
Ghost
@ghost~61130d956da037398482e4b1
Hi, everyone. Please check the contract and I'm happy if you let me know why it has higher than normal gas fee for buy/sell.
benjymm
@benjymm
hi, is there any discord for solidity or this is the main group?
Danny Pr.
@dannpr

Hi I'm actually doing an online course and I'm developping on nextjs but I have this poblem on my web3.js code :Server Error
ReferenceError: window is not defined

This error happened while generating the page. Any console logs will be displayed in the terminal window.
Source
eth/web3.js (3:0) @ eval

1 | import Web3 from "web3";
2 |

3 | window.ethereum.request({ method: "eth_requestAccounts" });
4 |
5 | const web3 = new Web3(window.ethereum);
6 |