Questions tagged [library]

Libraries are reusable code. In the context of smart contracts, they are deployed only once at a specific address and their code is reused using DELEGATECALL.

Filter by
Sorted by
Tagged with
33
votes
2answers
5k views

What are the steps to compile and deploy a library in Solidity?

I have several pieces of documentation about libraries, but I am not yet able to infer what steps are needed to compile and deploy a library and then a contract that uses it. The behavior of the ...
24
votes
1answer
13k views

How does the delegatecall method work to call to another contract's method?

I'm trying to figure out how to use the delegatecall method on a contract address in a contract to call a function in a separate contract. I know Libraries are the higher level interface to use but I ...
4
votes
2answers
336 views

Usage of ENS for contract upgrade

Situation: let's assume we have a data storage contract libraries that import the data storage contract a business logic contract that implements the libraries Question: can we use ENS, or more ...
4
votes
4answers
5k views

Ethereum library for iOS/Android?

Are there any existing native libraries (not whole wallets, I do not need a UI but want to sign transactions and call smart contract functions embedded in another app) for iOS or Android? If not, are ...
6
votes
1answer
2k views

How can I deploy a contract with reference to a library contract without using a graphical user interface like Browser Solidity?

I am using Solidity Browser to deploy a contract due to from Library contract method failing #2831 issue. On this following answer https://ethereum.stackexchange.com/a/9181/4575 I have guided to use ...
2
votes
2answers
512 views

How can I program my DApp to tell my user that their action/transaction has been confirmed?

Take an example of a voting DApp. A user clicks on a vote button, then behind the scenes the transaction containing the vote gets mined on the blockchain. The DApp then wants to alert('You have ...
9
votes
1answer
3k views

Finding and Using Solidity Libraries (ie. Math functions)

How do I find and use any existing Solidity libraries like you might in Javascript? For example, Math functions: How do I implement the equivalent of Math.sqrt(x) in a solidity function? Related: ...
2
votes
2answers
916 views

Is it possible for a smart contract to be able to adjust it's conditions based on the current value of Ethereum?

I ask this because I want to create a crowdfunding smart contract for a platform much like Kickstarter. At this point, the only crypto asset I want the contract to raise is Ether with the possibility ...
6
votes
2answers
1k views

How to make a library address updatable

I want to write a contract that uses a library. This library should be exchangable. Meaning I want the contract to have an updatable (only by owner) address variable always pointing to the current ...
4
votes
1answer
317 views

Out of gas error deploying library

The following code is compiled with solc 0.3 with correct --libraries linking and deployed to morden. Math library is deployed just fine and can be accessed. However A doesn't get deployed on morden ...
8
votes
1answer
447 views

How to handle library function prototype changes?

One great thing about using a library is that the library code can be modified, and as long as the api function prototype stays the same, all we need to do is point to the new address of the updated ...
9
votes
1answer
2k views

How to link libraries in browser-solidity? [duplicate]

How to link library in browser-solidity? While creating a contract using library, solidity compiler requires to link the contract with the library. But there is no options in the browser to provide it....
7
votes
3answers
2k views

How to import solidity libraries in mix?

Working in the MIX environment, I'd like to try using a libraries and contracts defined in different files. However, the main contract always gets an error from MIX, no matter how I define the "...
5
votes
2answers
245 views

Sending ethers with mocha.js and truffle might result in larger sums than intended

Good day, I have a contract General and a library GenLib. library GenLib{ event MoneyIn (address _from, uint256 _amount); function moneyIn() { MoneyIn(msg.sender, msg.value); <- ...
5
votes
1answer
448 views

return (bytes32,bytes32) , returns actual transaction address instead of the real data

I have attached my contract, which works fine on populus and compiles on geth. It is a simple source code: Test() function appends data into my linkedlist that is defined in my library. And get() ...