Currently the tokens of this contract are locked. I want to be able to figure out when the tokens of this contract have become transferrable in my python script. I'm using web3.py for this work.

Link to the contract: https://etherscan.io/address/0x971d048e737619884f2df75e31c7eb6412392328#code

There seems to be a transferLock argument inside the contract which stops the tokens from being transferred. There are also few others arguments and functions which seem to do a similar thing.

Can someone help me figure out how I can determine when the contract owner has unlocked the tokens?

  • I'd recommend copying in the relevant functions/variables into this question. Also, removed the python tags, since this is really a solidity question.
    – carver
    Aug 13, 2018 at 17:52
  • @carver Actually I'm trying to figure out if the tokens are transferrable from inside my python script. I'm using a python library called web3.py for this purpose. However since the locking mechanism is programmer dependent, I need to understand the contract script. That's the reason for linking to the contract code. In any case, the solution has to be python code using web3.py interface. I've re-added the tags and modified the question a little bit to make it clear. Let me know if you still see an issue with it.
    – aste123
    Aug 13, 2018 at 22:09

1 Answer 1


There seems to be two different locks in this contract.

The first is a global lock called transferLock which is used in this modifier:

modifier canTransfer() {
    if (msg.sender != owner) {

Any function which has the canTransfer modifier can only be accessed by the owner when transferLock = true.

There is another property unlocked which lives on the group object, which is supposed to check if the tokens in that group are locked. However, I do not see it being used anywhere relevant.

Furthermore, there seems to be a bug in the code for this property:

function relockGroup(uint256 groupNumber) public onlyOwner returns(bool success) {
    groups[groupNumber].unlocked = true;
    return true;

Feels like this function should set groups[groupNumber].unlocked = false, and I see no way to "relock" a group after it has been unlocked.

Both of these properties can be queried or found on Etherscan here:


  • Actually I want to check in my python script when this token is unlocked. I'm using web3.py. I had mentioned this in my question with relevant tags which were later removed. Since the contracts are supposed to be read only, I'm unsure of the unlock process. And once unlocked, how do I determine the state of the token from my python script? Thank you.
    – aste123
    Aug 13, 2018 at 22:15
  • 1
    You can use the contract ABI and the contract address to read the property of transferLock. You should share code of how far you have gotten, and then we can easily help fill in the the rest. Aug 13, 2018 at 22:17
  • Thank you. That's what I needed to know. If you don't mind, can you tell me how is unlocking possible in this case even though the smart contract is supposed to be immutable? So, the code which states that transferLock is True shouldn't be able to be modified to False, isn't that what immutable means.
    – aste123
    Aug 13, 2018 at 22:25
  • 1
    There is a function in the contract called setGlobalLock(bool value) which allows the owner to set the lock value to either true or false. The contract code is immutable, but the variables within it can change state, or else it wouldn't be a very useful platform for writing programs right? Aug 13, 2018 at 23:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.